test_chainid()
Documentation for tests/istanbul/eip1344_chainid/test_chainid.py::test_chainid@tests-snobal-devnet-6@v1.1.0.
Generate fixtures for these test cases for Amsterdam with:
fill -v tests/istanbul/eip1344_chainid/test_chainid.py::test_chainid --fork Amsterdam
Test CHAINID opcode.
Source code in tests/istanbul/eip1344_chainid/test_chainid.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 | @pytest.mark.with_all_typed_transactions(
marks=lambda tx_type: (
pytest.mark.execute(
pytest.mark.skip(
reason="type 3 transactions aren't supported in execute mode"
)
)
if tx_type == 3
else None
)
)
@pytest.mark.ported_from(
[
"https://github.com/ethereum/tests/blob/v13.3/src/GeneralStateTestsFiller/stChainId/chainIdFiller.json",
],
)
@pytest.mark.valid_from("Istanbul")
def test_chainid(
state_test: StateTestFiller,
pre: Alloc,
chain_config: ChainConfig,
typed_transaction: Transaction,
) -> None:
"""Test CHAINID opcode."""
chain_id = chain_config.chain_id
contract_address = pre.deploy_contract(Op.SSTORE(1, Op.CHAINID) + Op.STOP)
tx = typed_transaction.copy(
chain_id=chain_id,
to=contract_address,
)
post = {
contract_address: Account(storage={1: chain_id}),
}
state_test(pre=pre, post=post, tx=tx)
|
Parametrized Test Cases
This test generates 5 parametrized test cases across 9 forks.