Skip to content

Commit

Permalink
Add unit test for EXTCODECOPY of delegated account
Browse files Browse the repository at this point in the history
  • Loading branch information
gumb0 committed Nov 27, 2024
1 parent a892f86 commit a40c1a2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/unittests/state_transition_eip7702_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,24 @@ TEST_F(state_transition, eip7702_extcodehash_delegation_to_empty)
expect.post[To].storage[0x01_bytes32] = 0x01_bytes32;
}

TEST_F(state_transition, eip7702_extcodecopy)
{
rev = EVMC_PRAGUE;

constexpr auto callee = 0xca11ee_address;
constexpr auto delegate = 0xde1e_address;
pre[callee] = {.nonce = 1, .code = bytes{0xef, 0x01, 0x00} + hex(delegate)};
tx.to = To;
pre[To] = {.code = push(10) + push0() + push0() + push(callee) + OP_EXTCODECOPY +
sstore(0, mload(0)) + sstore(1, 1)};

expect.post[callee].exists = true;
expect.post[delegate].exists = false;
expect.post[To].storage[0x00_bytes32] =
0xef01000000000000000000000000000000000000000000000000000000000000_bytes32;
expect.post[To].storage[0x01_bytes32] = 0x01_bytes32;
}

TEST_F(state_transition, eip7702_call)
{
rev = EVMC_PRAGUE;
Expand Down

0 comments on commit a40c1a2

Please sign in to comment.