Skip to content

Commit

Permalink
src: Only add fcu version to fixture for hive.
Browse files Browse the repository at this point in the history
  • Loading branch information
spencer-tb committed Sep 6, 2023
1 parent 3fec884 commit f5c5e79
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/ethereum_test_forks/base_fork.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions src/ethereum_test_forks/forks/forks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down
5 changes: 5 additions & 0 deletions src/ethereum_test_tools/common/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions src/ethereum_test_tools/filling/fill.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions whitelist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ extcodesize
fn
fname
forkchoice
fcu
formatOnSave
formatter
fromhex
Expand Down

0 comments on commit f5c5e79

Please sign in to comment.