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