From f5c5e79decf191a82f506b12c3b671b85e560b09 Mon Sep 17 00:00:00 2001 From: spencer-tb Date: Wed, 6 Sep 2023 11:50:33 +0200 Subject: [PATCH] src: Only add fcu version to fixture for hive. --- src/ethereum_test_forks/base_fork.py | 10 ++++++++++ src/ethereum_test_forks/forks/forks.py | 9 +++++++++ src/ethereum_test_tools/common/types.py | 5 +++++ src/ethereum_test_tools/filling/fill.py | 5 +++++ whitelist.txt | 1 + 5 files changed, 30 insertions(+) diff --git a/src/ethereum_test_forks/base_fork.py b/src/ethereum_test_forks/base_fork.py index 1bc51683fc..2ddfbe13c2 100644 --- a/src/ethereum_test_forks/base_fork.py +++ b/src/ethereum_test_forks/base_fork.py @@ -174,6 +174,16 @@ def engine_new_payload_beacon_root(cls, block_number: int = 0, timestamp: int = """ pass + @classmethod + @abstractmethod + def engine_forkchoice_updated_version( + cls, block_number: int = 0, timestamp: int = 0 + ) -> Optional[int]: + """ + Returns `None` if the forks canonical chain cannot be set using the forkchoice method. + """ + pass + # Meta information about the fork @classmethod def name(cls) -> str: diff --git a/src/ethereum_test_forks/forks/forks.py b/src/ethereum_test_forks/forks/forks.py index c8e7fe86eb..8a45ba91a1 100644 --- a/src/ethereum_test_forks/forks/forks.py +++ b/src/ethereum_test_forks/forks/forks.py @@ -91,6 +91,15 @@ def engine_new_payload_beacon_root(cls, block_number: int = 0, timestamp: int = """ return False + @classmethod + def engine_forkchoice_updated_version( + cls, block_number: int = 0, timestamp: int = 0 + ) -> Optional[int]: + """ + At genesis, forkchoice updates cannot be sent through the engine API. + """ + return cls.engine_new_payload_version(block_number, timestamp) + @classmethod def get_reward(cls, block_number: int = 0, timestamp: int = 0) -> int: """ diff --git a/src/ethereum_test_tools/common/types.py b/src/ethereum_test_tools/common/types.py index 59d33f73bf..7ee3d8f21f 100644 --- a/src/ethereum_test_tools/common/types.py +++ b/src/ethereum_test_tools/common/types.py @@ -2674,6 +2674,11 @@ class Fixture: to_json=True, ), ) + fcu_version: Optional[int] = field( + json_encoder=JSONEncoder.Field( + name="engineFcuVersion", + ), + ) genesis: FixtureHeader = field( json_encoder=JSONEncoder.Field( name="genesisBlockHeader", diff --git a/src/ethereum_test_tools/filling/fill.py b/src/ethereum_test_tools/filling/fill.py index 9a4d5e9435..2169239cf3 100644 --- a/src/ethereum_test_tools/filling/fill.py +++ b/src/ethereum_test_tools/filling/fill.py @@ -44,6 +44,11 @@ def fill_test( pre_state=pre, post_state=alloc_to_accounts(alloc), seal_engine=engine, + fcu_version=fork.engine_forkchoice_updated_version( + blocks[-1].block_header.number, blocks[-1].block_header.timestamp + ) + if not test_spec.base_test_config.disable_hive and blocks[-1].block_header + else None, name=test_spec.tag, ) fixture.fill_info(t8n, spec) diff --git a/whitelist.txt b/whitelist.txt index a1d56eb82e..9aa6661d87 100644 --- a/whitelist.txt +++ b/whitelist.txt @@ -83,6 +83,7 @@ extcodesize fn fname forkchoice +fcu formatOnSave formatter fromhex