Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(fw): add chain id to all fixtures #796

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions src/ethereum_test_fixtures/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/ethereum_test_fixtures/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/ethereum_test_specs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/ethereum_test_specs/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
spencer-tb marked this conversation as resolved.
Show resolved Hide resolved

supported_fixture_formats: ClassVar[List[FixtureFormat]] = [
BlockchainFixture,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/ethereum_test_specs/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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={
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"000/my_blockchain_test/London": {
"_info": {
"hash": "0x4de3f84e3cb1e678141d81ce96ce75edb53f1824a708e26098b610c3c1030e66"
"hash": "0xde0db4518cb2732da0eb2ee84cfe0d22831f5cbf35433c30712f1fe8c0cd69a2"
},
"network": "London",
"chainId": "0x01",
"genesisRLP": "0xf90200f901fba00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a089a5be1d3306f6f05b42678ef13ac3dbc37bef9a2a80862c21eb22eee29194c2a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200008088016345785d8a0000808000a000000000000000000000000000000000000000000000000000000000000000008800000000000000008203e8c0c0",
"genesisBlockHeader": {
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"000/my_blockchain_test/London": {
"_info": {
"hash": "0x91032fb245f4488b204198312cbf16429c121435705ac3f9c6eb3943ec0bc36d"
"hash": "0xa59b9cc35aafe088a6940102313eaeea785f3e96df7e1f58dcfe20784824b26e"
},
"network": "London",
"chainId": "0x01",
"genesisRLP": "0xf90200f901fba00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a089a5be1d3306f6f05b42678ef13ac3dbc37bef9a2a80862c21eb22eee29194c2a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200008088016345785d8a0000808000a000000000000000000000000000000000000000000000000000000000000000008800000000000000008203e8c0c0",
"genesisBlockHeader": {
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
Expand Down
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"000/my_chain_id_test/Istanbul": {
"_info": {
"hash": "0x3ca9936ff21270dd7ac781b5fafd98e4264bc9fcff4ab3cc8dff0677ccf7fc25"
"hash": "0x55a090cb95a019ad95056bca86a833d08c79cca62615a67da4757dd42cb5d027"
},
"network": "Istanbul",
"chainId": "0x01",
"genesisRLP": "0xf901faf901f5a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0aff9f63320a482f8c4e4f15f659e6a7ac382138fbbb6919243b0cba4c5988a5aa056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000808502540be400808000a00000000000000000000000000000000000000000000000000000000000000000880000000000000000c0c0",
"genesisBlockHeader": {
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"000/my_chain_id_test/London": {
"_info": {
"hash": "0x9c09a561959f81ff5e5b081b9081bd626739fa029e9d411ea89797673366eb80"
"hash": "0x1eb6a60d96a93be5e7bdd86ae2d27e6390bad24dae48883861acaa9cffbfc278"
},
"network": "London",
"chainId": "0x01",
"genesisRLP": "0xf901fbf901f6a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0aff9f63320a482f8c4e4f15f659e6a7ac382138fbbb6919243b0cba4c5988a5aa056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000808502540be400808000a0000000000000000000000000000000000000000000000000000000000000000088000000000000000007c0c0",
"genesisBlockHeader": {
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"000/my_chain_id_test/Paris": {
"_info": {
"hash": "0x1c6d2ca8e03c5074e8afadbad869c90b61d2f9752c5ef2d7908900aa000a3878"
"hash": "0xea4f540cc129ace3ae48af60551dcc5dc63c0fe2f067080c3c5ffb245b9a882a"
},
"network": "Paris",
"chainId": "0x01",
"lastblockhash": "0xe92eedff2a0489bd861f528e248994b6791b0f5b845d90b34c68bc8cbc51c369",
"genesisBlockHeader": {
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"000/my_chain_id_test/Paris": {
"_info": {
"hash": "0x9533310242d3fe15fca5ea1d31f97121f7db0f54843c9f2160c01f2468b10535"
"hash": "0xd8c863777e2efb178ebef6661f879439ec6411849b313af0326183d701039ef5"
},
"chainId": "0x01",
"env": {
"currentCoinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentGasLimit": "0x02540be400",
Expand Down
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"000/my_chain_id_test/Shanghai": {
"_info": {
"hash": "0xac10a919bea8bb3bc6b74cb291d92ce12549216dd78dde2d2bd6d94fd48897aa"
"hash": "0x28112159ff2ea133b0864f428ef5b24d1e95ff14406f5ad8e16f70fdcac48199"
},
"chainId": "0x01",
"env": {
"currentCoinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentGasLimit": "0x02540be400",
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_plugins/consume/hive_simulators/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()},
Expand Down