Skip to content

Commit

Permalink
Fix CALLs in EIP-7702
Browse files Browse the repository at this point in the history
  • Loading branch information
gumb0 committed Aug 19, 2024
1 parent ccc0fb3 commit 3ff5253
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 3 additions & 4 deletions test/state/host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,8 @@ evmc::Result Host::execute_message(const evmc_message& msg) noexcept
m_state.journal_create(msg.recipient, exists);
}

assert(msg.kind != EVMC_CALL || evmc::address{msg.recipient} == msg.code_address);
auto* const dst_acc =
(msg.kind == EVMC_CALL) ? &m_state.touch(msg.recipient) : m_state.find(msg.code_address);
auto* const dst_acc = &m_state.touch(msg.recipient);
const auto* const code_acc = m_state.find(msg.code_address);

if (msg.kind == EVMC_CALL && !evmc::is_zero(msg.value))
{
Expand All @@ -395,7 +394,7 @@ evmc::Result Host::execute_message(const evmc_message& msg) noexcept
if (is_precompile(m_rev, msg.code_address))
return call_precompile(m_rev, msg);

const auto code = dst_acc != nullptr ? bytes_view{dst_acc->code} : bytes_view{};
const auto code = code_acc != nullptr ? bytes_view{code_acc->code} : bytes_view{};
return m_vm.execute(*this, m_rev, msg, code.data(), code.size());
}

Expand Down
2 changes: 0 additions & 2 deletions test/state/state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,6 @@ std::variant<TransactionReceipt, std::error_code> transition(State& state, const

std::copy_n(message.code_address.bytes, std::size(message.code_address.bytes),
&to_ptr->code[std::size(DELEGATION_MAGIC)]);

Check warning on line 569 in test/state/state.cpp

View check run for this annotation

Codecov / codecov/patch

test/state/state.cpp#L568-L569

Added lines #L568 - L569 were not covered by tests

message.kind = EVMC_DELEGATECALL;
}
}

Expand Down

0 comments on commit 3ff5253

Please sign in to comment.