Skip to content

Commit 92511c7

Browse files
author
Stuart Reed
authored
feat(tests): Additional EIP-2935 coverage (#1379)
Update CHANGELOG.md
1 parent 8dd8df1 commit 92511c7

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ consume cache --help
6666

6767
- ✨ Add additional test coverage for EIP-152 Blake2 precompiles ([#1244](https://github.com/ethereum/execution-spec-tests/pull/1244)). Refactor to add variables for spec constants and common fixture code. ([#1395](https://github.com/ethereum/execution-spec-tests/pull/1395)).
6868
- ✨ Add EIP-7702 incorrect-rlp-encoding tests ([#1347](https://github.com/ethereum/execution-spec-tests/pull/1347)).
69+
- ✨ Add EIP-2935 tests for all call opcodes ([#1379](https://github.com/ethereum/execution-spec-tests/pull/1379)).
6970

7071
## [v4.1.0](https://github.com/ethereum/execution-spec-tests/releases/tag/v4.1.0) - 2025-03-11
7172

tests/prague/eip2935_historical_block_hashes_from_state/test_block_hashes.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,55 @@ def test_block_hashes_history(
315315
)
316316

317317

318+
@pytest.mark.valid_from("Prague")
319+
@pytest.mark.with_all_call_opcodes
320+
def test_block_hashes_call_opcodes(
321+
blockchain_test: BlockchainTestFiller, pre: Alloc, call_opcode: Op
322+
):
323+
"""Test that the call opcodes can be used to call the history contract and get the block hashes.""" # noqa: E501
324+
blocks = []
325+
blocks.append(Block())
326+
327+
storage = Storage()
328+
return_code_slot = storage.store_next(0x1)
329+
blockhash_value_slot = storage.store_next(
330+
True if call_opcode in [Op.DELEGATECALL, Op.CALLCODE] else False
331+
)
332+
333+
code = (
334+
Op.MSTORE(0, 1)
335+
+ Op.SSTORE(
336+
return_code_slot,
337+
call_opcode(
338+
address=Spec.HISTORY_STORAGE_ADDRESS,
339+
args_offset=0,
340+
args_size=32,
341+
ret_offset=32,
342+
ret_size=32,
343+
),
344+
)
345+
+ Op.SSTORE(blockhash_value_slot, Op.ISZERO(Op.MLOAD(32)))
346+
)
347+
348+
contract_address = pre.deploy_contract(code, storage=storage.canary())
349+
blocks.append(
350+
Block(
351+
txs=[
352+
Transaction(
353+
to=contract_address,
354+
gas_limit=10_000_000,
355+
sender=pre.fund_eoa(),
356+
)
357+
]
358+
)
359+
)
360+
blockchain_test(
361+
pre=pre,
362+
blocks=blocks,
363+
post={contract_address: Account(storage=storage)},
364+
)
365+
366+
318367
@pytest.mark.parametrize(
319368
"block_number,reverts",
320369
[

0 commit comments

Comments
 (0)