Skip to content

Commit

Permalink
fix(tests): EIP-7702: Spec update #9248 (ethereum#1129)
Browse files Browse the repository at this point in the history
* fix(tests): EIP-7702: Spec update #9248

* docs: CHANGELOG
  • Loading branch information
marioevz committed Jan 30, 2025
1 parent d645dcb commit 2de9ab7
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 32 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Release tarball changes:
- 🔀 Update EIP-7002 according to [spec updates](https://github.com/ethereum/EIPs/pull/9119) ([#1024](https://github.com/ethereum/execution-spec-tests/pull/1024)).
- 🔀 Update EIP-2935 according to [spec updates](https://github.com/ethereum/EIPs/pull/9144) ([#1046](https://github.com/ethereum/execution-spec-tests/pull/1046))
-[EIP-7691](https://eips.ethereum.org/EIPS/eip-7691) Blob throughput increase tests by parametrization of existing EIP-4844 tests ([#1023](https://github.com/ethereum/execution-spec-tests/pull/1023), [#1082](https://github.com/ethereum/execution-spec-tests/pull/1082))
- 🔀 Update EIP-7702 test expectations according to [spec updates](https://github.com/ethereum/EIPs/pull/9248) ([#1129](https://github.com/ethereum/execution-spec-tests/pull/1129))
- ✨ Port [calldatacopy test](https://github.com/ethereum/tests/blob/ae4791077e8fcf716136e70fe8392f1a1f1495fb/src/GeneralStateTestsFiller/VMTests/vmTests/calldatacopyFiller.yml) ([#1056](https://github.com/ethereum/execution-spec-tests/pull/1056)).
-[EIP-152](https://eips.ethereum.org/EIPS/eip-152) Add tests for Blake2 compression function `F` precompile ([#1067](https://github.com/ethereum/execution-spec-tests/pull/1067))

Expand Down
1 change: 0 additions & 1 deletion tests/prague/eip7702_set_code_tx/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class Spec:
PER_AUTH_BASE_COST = 12_500
PER_EMPTY_ACCOUNT_COST = 25_000
DELEGATION_DESIGNATION = Bytes("ef0100")
DELEGATION_DESIGNATION_READING = Bytes("ef01")
RESET_DELEGATION_ADDRESS = Address(0)

MAX_AUTH_CHAIN_ID = 2**256 - 1
Expand Down
64 changes: 39 additions & 25 deletions tests/prague/eip7702_set_code_tx/test_set_code_txs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1075,11 +1075,15 @@ def test_ext_code_on_set_code(
raise ValueError(f"Unsupported set code type: {set_code_type}")

callee_storage = Storage()
callee_storage[slot_ext_code_size_result] = len(Spec.DELEGATION_DESIGNATION_READING)
callee_storage[slot_ext_code_hash_result] = Spec.DELEGATION_DESIGNATION_READING.keccak256()
callee_storage[slot_ext_code_copy_result] = Spec.DELEGATION_DESIGNATION_READING.ljust(
32, b"\x00"
)[:32]
callee_storage[slot_ext_code_size_result] = len(
Spec.delegation_designation(set_code_to_address)
)
callee_storage[slot_ext_code_hash_result] = Spec.delegation_designation(
set_code_to_address
).keccak256()
callee_storage[slot_ext_code_copy_result] = Hash(
Spec.delegation_designation(set_code_to_address), right_padding=True
)
callee_storage[slot_ext_balance_result] = balance

tx = Transaction(
Expand Down Expand Up @@ -1144,11 +1148,15 @@ def test_ext_code_on_self_set_code(
set_code_address = pre.deploy_contract(set_code)

set_code_storage = Storage()
set_code_storage[slot_ext_code_size_result] = len(Spec.DELEGATION_DESIGNATION_READING)
set_code_storage[slot_ext_code_hash_result] = Spec.DELEGATION_DESIGNATION_READING.keccak256()
set_code_storage[slot_ext_code_copy_result] = Spec.DELEGATION_DESIGNATION_READING.ljust(
32, b"\x00"
)[:32]
set_code_storage[slot_ext_code_size_result] = len(
Spec.delegation_designation(set_code_address)
)
set_code_storage[slot_ext_code_hash_result] = Spec.delegation_designation(
set_code_address
).keccak256()
set_code_storage[slot_ext_code_copy_result] = Hash(
Spec.delegation_designation(set_code_address), right_padding=True
)
set_code_storage[slot_ext_balance_result] = balance

tx = Transaction(
Expand Down Expand Up @@ -1364,11 +1372,13 @@ def test_ext_code_on_self_delegating_set_code(
callee_address = pre.deploy_contract(callee_code)
callee_storage = Storage()

callee_storage[slot_ext_code_size_result] = len(Spec.DELEGATION_DESIGNATION_READING)
callee_storage[slot_ext_code_hash_result] = Spec.DELEGATION_DESIGNATION_READING.keccak256()
callee_storage[slot_ext_code_copy_result] = Spec.DELEGATION_DESIGNATION_READING.ljust(
32, b"\x00"
)[:32]
callee_storage[slot_ext_code_size_result] = len(Spec.delegation_designation(auth_signer))
callee_storage[slot_ext_code_hash_result] = Spec.delegation_designation(
auth_signer
).keccak256()
callee_storage[slot_ext_code_copy_result] = Hash(
Spec.delegation_designation(auth_signer), right_padding=True
)
callee_storage[slot_ext_balance_result] = balance

tx = Transaction(
Expand Down Expand Up @@ -1443,18 +1453,22 @@ def test_ext_code_on_chain_delegating_set_code(
callee_address = pre.deploy_contract(callee_code)
callee_storage = Storage()

callee_storage[slot_ext_code_size_result_1] = len(Spec.DELEGATION_DESIGNATION_READING)
callee_storage[slot_ext_code_hash_result_1] = Spec.DELEGATION_DESIGNATION_READING.keccak256()
callee_storage[slot_ext_code_copy_result_1] = Spec.DELEGATION_DESIGNATION_READING.ljust(
32, b"\x00"
)[:32]
callee_storage[slot_ext_code_size_result_1] = len(Spec.delegation_designation(auth_signer_2))
callee_storage[slot_ext_code_hash_result_1] = Spec.delegation_designation(
auth_signer_2
).keccak256()
callee_storage[slot_ext_code_copy_result_1] = Hash(
Spec.delegation_designation(auth_signer_2), right_padding=True
)
callee_storage[slot_ext_balance_result_1] = auth_signer_1_balance

callee_storage[slot_ext_code_size_result_2] = len(Spec.DELEGATION_DESIGNATION_READING)
callee_storage[slot_ext_code_hash_result_2] = Spec.DELEGATION_DESIGNATION_READING.keccak256()
callee_storage[slot_ext_code_copy_result_2] = Spec.DELEGATION_DESIGNATION_READING.ljust(
32, b"\x00"
)[:32]
callee_storage[slot_ext_code_size_result_2] = len(Spec.delegation_designation(auth_signer_1))
callee_storage[slot_ext_code_hash_result_2] = Spec.delegation_designation(
auth_signer_1
).keccak256()
callee_storage[slot_ext_code_copy_result_2] = Hash(
Spec.delegation_designation(auth_signer_1), right_padding=True
)
callee_storage[slot_ext_balance_result_2] = auth_signer_2_balance

tx = Transaction(
Expand Down
10 changes: 4 additions & 6 deletions tests/prague/eip7702_set_code_tx/test_set_code_txs_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,22 +254,20 @@ def test_pointer_measurements(blockchain_test: BlockchainTestFiller, pre: Alloc)
+ Op.SSTORE(storage_normal.store_next(100, "balance"), Op.BALANCE(pointer))
+ Op.STOP,
)

delegation_designation = Spec.delegation_designation(pointer_code)
contract_measurements_pointer = pre.deploy_contract(
code=Op.EXTCODECOPY(pointer, 0, 0, 32)
+ Op.SSTORE(
storage_pointer.store_next(
Spec.DELEGATION_DESIGNATION_READING.keccak256(), "extcodehash"
),
storage_pointer.store_next(delegation_designation.keccak256(), "extcodehash"),
Op.EXTCODEHASH(pointer),
)
+ Op.SSTORE(
storage_pointer.store_next(len(Spec.DELEGATION_DESIGNATION_READING), "extcodesize"),
storage_pointer.store_next(len(delegation_designation), "extcodesize"),
Op.EXTCODESIZE(pointer),
)
+ Op.SSTORE(
storage_pointer.store_next(
Hash(Spec.DELEGATION_DESIGNATION_READING, right_padding=True), "extcodecopy"
Hash(delegation_designation, right_padding=True), "extcodecopy"
),
Op.MLOAD(0),
)
Expand Down

0 comments on commit 2de9ab7

Please sign in to comment.