diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 18f806d8fc..83575d6229 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -78,6 +78,7 @@ Test fixtures for use by clients are available for each release on the [Github r - The EOF fixture format contained in `eof_tests` may now contain multiple exceptions in the `"exception"` field in the form of a pipe (`|`) separated string ([#759](https://github.com/ethereum/execution-spec-tests/pull/759)). - Remove redundant tests within stable and develop fixture releases, moving them to a separate legacy release ([#788](https://github.com/ethereum/execution-spec-tests/pull/788)). +- The `chain_id` is now added to all fixture types. Clients are advised to parse this when consuming fixtures ([#796](https://github.com/ethereum/execution-spec-tests/pull/796)). ## [v3.0.0](https://github.com/ethereum/execution-spec-tests/releases/tag/v3.0.0) - 2024-07-22 diff --git a/src/ethereum_test_fixtures/blockchain.py b/src/ethereum_test_fixtures/blockchain.py index 27de996526..a7c0b55e1a 100644 --- a/src/ethereum_test_fixtures/blockchain.py +++ b/src/ethereum_test_fixtures/blockchain.py @@ -431,6 +431,7 @@ class FixtureCommon(BaseFixture): """ fork: str = Field(..., alias="network") + chain_id: ZeroPaddedHexNumber = Field(..., alias="chainId") genesis: FixtureHeader = Field(..., alias="genesisBlockHeader") pre: Alloc post_state: Alloc | None = Field(None) diff --git a/src/ethereum_test_fixtures/state.py b/src/ethereum_test_fixtures/state.py index b317601f8a..7dc4c3a9da 100644 --- a/src/ethereum_test_fixtures/state.py +++ b/src/ethereum_test_fixtures/state.py @@ -109,6 +109,7 @@ class Fixture(BaseFixture): fixture_format_name: ClassVar[str] = "state_test" description: ClassVar[str] = "Tests that generate a state test fixture." + chain_id: ZeroPaddedHexNumber = Field(..., alias="chainId") env: FixtureEnvironment pre: Alloc transaction: FixtureTransaction diff --git a/src/ethereum_test_specs/base.py b/src/ethereum_test_specs/base.py index f8484268a8..dab59860dc 100644 --- a/src/ethereum_test_specs/base.py +++ b/src/ethereum_test_specs/base.py @@ -48,6 +48,7 @@ class BaseTest(BaseModel): """ tag: str = "" + chain_id: int = 1 # Transition tool specific fields t8n_dump_dir: Path | None = Field(None, exclude=True) diff --git a/src/ethereum_test_specs/blockchain.py b/src/ethereum_test_specs/blockchain.py index 64a0ccde74..457293c29e 100644 --- a/src/ethereum_test_specs/blockchain.py +++ b/src/ethereum_test_specs/blockchain.py @@ -301,7 +301,6 @@ class BlockchainTest(BaseTest): blocks: List[Block] genesis_environment: Environment = Field(default_factory=Environment) verify_sync: bool = False - chain_id: int = 1 supported_fixture_formats: ClassVar[List[FixtureFormat]] = [ BlockchainFixture, @@ -589,6 +588,7 @@ def make_fixture( self.verify_post_state(t8n, alloc) return Fixture( fork=self.network_info(fork, eips), + chain_id=self.chain_id, genesis=genesis.header, genesis_rlp=genesis.rlp, blocks=fixture_blocks, @@ -671,6 +671,7 @@ def make_hive_fixture( return EngineFixture( fork=self.network_info(fork, eips), + chain_id=self.chain_id, genesis=genesis.header, payloads=fixture_payloads, fcu_version=fcu_version, diff --git a/src/ethereum_test_specs/state.py b/src/ethereum_test_specs/state.py index 4595d2f6bb..b39a4c7c89 100644 --- a/src/ethereum_test_specs/state.py +++ b/src/ethereum_test_specs/state.py @@ -47,7 +47,6 @@ class StateTest(BaseTest): engine_api_error_code: Optional[EngineAPIError] = None blockchain_test_header_verify: Optional[Header] = None blockchain_test_rlp_modifier: Optional[Header] = None - chain_id: int = 1 supported_fixture_formats: ClassVar[List[FixtureFormat]] = [ BlockchainFixture, @@ -112,6 +111,7 @@ def generate_blockchain_test(self) -> BlockchainTest: Generate a BlockchainTest fixture from this StateTest fixture. """ return BlockchainTest( + chain_id=self.chain_id, genesis_environment=self._generate_blockchain_genesis_environment(), pre=self.pre, post=self.post, @@ -168,6 +168,7 @@ def make_state_test_fixture( raise e return Fixture( + chain_id=self.chain_id, env=FixtureEnvironment(**env.model_dump(exclude_none=True)), pre=pre_alloc, post={ diff --git a/src/ethereum_test_specs/tests/fixtures/blockchain_london_invalid_filled.json b/src/ethereum_test_specs/tests/fixtures/blockchain_london_invalid_filled.json index 3ee643a0bc..f14b6d2a9e 100644 --- a/src/ethereum_test_specs/tests/fixtures/blockchain_london_invalid_filled.json +++ b/src/ethereum_test_specs/tests/fixtures/blockchain_london_invalid_filled.json @@ -1,9 +1,10 @@ { "000/my_blockchain_test/London": { "_info": { - "hash": "0x4de3f84e3cb1e678141d81ce96ce75edb53f1824a708e26098b610c3c1030e66" + "hash": "0xde0db4518cb2732da0eb2ee84cfe0d22831f5cbf35433c30712f1fe8c0cd69a2" }, "network": "London", + "chainId": "0x01", "genesisRLP": "0xf90200f901fba00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a089a5be1d3306f6f05b42678ef13ac3dbc37bef9a2a80862c21eb22eee29194c2a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200008088016345785d8a0000808000a000000000000000000000000000000000000000000000000000000000000000008800000000000000008203e8c0c0", "genesisBlockHeader": { "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", diff --git a/src/ethereum_test_specs/tests/fixtures/blockchain_london_valid_filled.json b/src/ethereum_test_specs/tests/fixtures/blockchain_london_valid_filled.json index d8e6edb3b7..f47b98f38c 100644 --- a/src/ethereum_test_specs/tests/fixtures/blockchain_london_valid_filled.json +++ b/src/ethereum_test_specs/tests/fixtures/blockchain_london_valid_filled.json @@ -1,9 +1,10 @@ { "000/my_blockchain_test/London": { "_info": { - "hash": "0x91032fb245f4488b204198312cbf16429c121435705ac3f9c6eb3943ec0bc36d" + "hash": "0xa59b9cc35aafe088a6940102313eaeea785f3e96df7e1f58dcfe20784824b26e" }, "network": "London", + "chainId": "0x01", "genesisRLP": "0xf90200f901fba00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a089a5be1d3306f6f05b42678ef13ac3dbc37bef9a2a80862c21eb22eee29194c2a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200008088016345785d8a0000808000a000000000000000000000000000000000000000000000000000000000000000008800000000000000008203e8c0c0", "genesisBlockHeader": { "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", diff --git a/src/ethereum_test_specs/tests/fixtures/blockchain_shanghai_invalid_filled_engine.json b/src/ethereum_test_specs/tests/fixtures/blockchain_shanghai_invalid_filled_engine.json index 33f7a73f7b..22f68e48be 100644 --- a/src/ethereum_test_specs/tests/fixtures/blockchain_shanghai_invalid_filled_engine.json +++ b/src/ethereum_test_specs/tests/fixtures/blockchain_shanghai_invalid_filled_engine.json @@ -1,10 +1,11 @@ { "000/my_blockchain_test/Shanghai": { "_info": { - "hash": "0x107426e7483fe00d8db263f7522d523a6efbed5c93fd98006e65593ce496a1c4" + "hash": "0x2ab6af0a5279f68b03e0b382616f0def195177e43829d34212d16e80e4c3e5f6" }, "lastblockhash": "0xfc75f11c05ec814a890141bef919bb7c20dd29245e37e9bcea66008dfde98526", "network": "Shanghai", + "chainId": "0x01", "genesisBlockHeader": { "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", diff --git a/src/ethereum_test_specs/tests/fixtures/blockchain_shanghai_valid_filled_engine.json b/src/ethereum_test_specs/tests/fixtures/blockchain_shanghai_valid_filled_engine.json index 3270566ec0..dcdfe3fd8c 100644 --- a/src/ethereum_test_specs/tests/fixtures/blockchain_shanghai_valid_filled_engine.json +++ b/src/ethereum_test_specs/tests/fixtures/blockchain_shanghai_valid_filled_engine.json @@ -1,10 +1,11 @@ { "000/my_blockchain_test/Shanghai": { "_info": { - "hash": "0x9a25679729dab0fa4d90f56a7458ca2c4b7428853e9ef1e1aea6dae203926368" + "hash": "0xdb14f7d22b78241a6e80a1b420759b4dfcf21f5459840609d1c20922baf6b68e" }, "lastblockhash": "0xfc75f11c05ec814a890141bef919bb7c20dd29245e37e9bcea66008dfde98526", "network": "Shanghai", + "chainId": "0x01", "genesisBlockHeader": { "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", diff --git a/src/ethereum_test_specs/tests/fixtures/chainid_istanbul_blockchain_test.json b/src/ethereum_test_specs/tests/fixtures/chainid_istanbul_blockchain_test.json index 040110f9c5..42e38d21b2 100644 --- a/src/ethereum_test_specs/tests/fixtures/chainid_istanbul_blockchain_test.json +++ b/src/ethereum_test_specs/tests/fixtures/chainid_istanbul_blockchain_test.json @@ -1,9 +1,10 @@ { "000/my_chain_id_test/Istanbul": { "_info": { - "hash": "0x3ca9936ff21270dd7ac781b5fafd98e4264bc9fcff4ab3cc8dff0677ccf7fc25" + "hash": "0x55a090cb95a019ad95056bca86a833d08c79cca62615a67da4757dd42cb5d027" }, "network": "Istanbul", + "chainId": "0x01", "genesisRLP": "0xf901faf901f5a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0aff9f63320a482f8c4e4f15f659e6a7ac382138fbbb6919243b0cba4c5988a5aa056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000808502540be400808000a00000000000000000000000000000000000000000000000000000000000000000880000000000000000c0c0", "genesisBlockHeader": { "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", diff --git a/src/ethereum_test_specs/tests/fixtures/chainid_london_blockchain_test.json b/src/ethereum_test_specs/tests/fixtures/chainid_london_blockchain_test.json index 0681eb1fe5..e88af22641 100644 --- a/src/ethereum_test_specs/tests/fixtures/chainid_london_blockchain_test.json +++ b/src/ethereum_test_specs/tests/fixtures/chainid_london_blockchain_test.json @@ -1,9 +1,10 @@ { "000/my_chain_id_test/London": { "_info": { - "hash": "0x9c09a561959f81ff5e5b081b9081bd626739fa029e9d411ea89797673366eb80" + "hash": "0x1eb6a60d96a93be5e7bdd86ae2d27e6390bad24dae48883861acaa9cffbfc278" }, "network": "London", + "chainId": "0x01", "genesisRLP": "0xf901fbf901f6a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0aff9f63320a482f8c4e4f15f659e6a7ac382138fbbb6919243b0cba4c5988a5aa056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000808502540be400808000a0000000000000000000000000000000000000000000000000000000000000000088000000000000000007c0c0", "genesisBlockHeader": { "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", diff --git a/src/ethereum_test_specs/tests/fixtures/chainid_paris_blockchain_test_engine.json b/src/ethereum_test_specs/tests/fixtures/chainid_paris_blockchain_test_engine.json index 792fb4798f..7bd56cfe8b 100644 --- a/src/ethereum_test_specs/tests/fixtures/chainid_paris_blockchain_test_engine.json +++ b/src/ethereum_test_specs/tests/fixtures/chainid_paris_blockchain_test_engine.json @@ -1,9 +1,10 @@ { "000/my_chain_id_test/Paris": { "_info": { - "hash": "0x1c6d2ca8e03c5074e8afadbad869c90b61d2f9752c5ef2d7908900aa000a3878" + "hash": "0xea4f540cc129ace3ae48af60551dcc5dc63c0fe2f067080c3c5ffb245b9a882a" }, "network": "Paris", + "chainId": "0x01", "lastblockhash": "0xe92eedff2a0489bd861f528e248994b6791b0f5b845d90b34c68bc8cbc51c369", "genesisBlockHeader": { "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", diff --git a/src/ethereum_test_specs/tests/fixtures/chainid_paris_state_test.json b/src/ethereum_test_specs/tests/fixtures/chainid_paris_state_test.json index bfe2cd2b2c..e26f1defce 100644 --- a/src/ethereum_test_specs/tests/fixtures/chainid_paris_state_test.json +++ b/src/ethereum_test_specs/tests/fixtures/chainid_paris_state_test.json @@ -1,8 +1,9 @@ { "000/my_chain_id_test/Paris": { "_info": { - "hash": "0x9533310242d3fe15fca5ea1d31f97121f7db0f54843c9f2160c01f2468b10535" + "hash": "0xd8c863777e2efb178ebef6661f879439ec6411849b313af0326183d701039ef5" }, + "chainId": "0x01", "env": { "currentCoinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentGasLimit": "0x02540be400", diff --git a/src/ethereum_test_specs/tests/fixtures/chainid_shanghai_blockchain_test_engine.json b/src/ethereum_test_specs/tests/fixtures/chainid_shanghai_blockchain_test_engine.json index 8f94dc8e94..a6070690e2 100644 --- a/src/ethereum_test_specs/tests/fixtures/chainid_shanghai_blockchain_test_engine.json +++ b/src/ethereum_test_specs/tests/fixtures/chainid_shanghai_blockchain_test_engine.json @@ -1,10 +1,11 @@ { "000/my_chain_id_test/Shanghai": { "_info": { - "hash": "0xfeded8f82a93725388c2436c76ea328cf2008dab43000de76306b3ed95de63b7" + "hash": "0x881251bb38b5be1afd02ee01b2743561dd491b4e57aea9d3159f5d6deb1c8b3a" }, "lastblockhash": "0x9c10141361e180632f7973f4f3a0aed2baa5ebb776bae84caafdcc07a24933e8", "network": "Shanghai", + "chainId": "0x01", "genesisBlockHeader": { "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", diff --git a/src/ethereum_test_specs/tests/fixtures/chainid_shanghai_state_test.json b/src/ethereum_test_specs/tests/fixtures/chainid_shanghai_state_test.json index 97c25aa49b..f9e59768c8 100644 --- a/src/ethereum_test_specs/tests/fixtures/chainid_shanghai_state_test.json +++ b/src/ethereum_test_specs/tests/fixtures/chainid_shanghai_state_test.json @@ -1,8 +1,9 @@ { "000/my_chain_id_test/Shanghai": { "_info": { - "hash": "0xac10a919bea8bb3bc6b74cb291d92ce12549216dd78dde2d2bd6d94fd48897aa" + "hash": "0x28112159ff2ea133b0864f428ef5b24d1e95ff14406f5ad8e16f70fdcac48199" }, + "chainId": "0x01", "env": { "currentCoinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentGasLimit": "0x02540be400", diff --git a/src/pytest_plugins/consume/hive_simulators/conftest.py b/src/pytest_plugins/consume/hive_simulators/conftest.py index 22b3dca09c..4130155da3 100644 --- a/src/pytest_plugins/consume/hive_simulators/conftest.py +++ b/src/pytest_plugins/consume/hive_simulators/conftest.py @@ -147,7 +147,7 @@ def environment(blockchain_fixture: BlockchainFixtureCommon) -> dict: blockchain_fixture.fork in ruleset ), f"fork '{blockchain_fixture.fork}' missing in hive ruleset" return { - "HIVE_CHAIN_ID": "1", + "HIVE_CHAIN_ID": blockchain_fixture.chain_id, "HIVE_FORK_DAO_VOTE": "1", "HIVE_NODETYPE": "full", **{k: f"{v:d}" for k, v in ruleset[blockchain_fixture.fork].items()},