Skip to content

Commit cd31f5b

Browse files
committed
src/forks: Tox fix for Beacon Root functions.
1 parent 4dbec5d commit cd31f5b

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/ethereum_test_forks/forks/forks.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def engine_new_payload_version(
7171
return None
7272

7373
@classmethod
74-
def header_beacon_root_required(cls, block_number: int, timestamp: int) -> bool:
74+
def header_beacon_root_required(cls, block_number: int = 0, timestamp: int = 0) -> bool:
7575
"""
7676
At genesis, header must not contain parent beacon block root
7777
"""
@@ -84,6 +84,13 @@ def engine_new_payload_blob_hashes(cls, block_number: int = 0, timestamp: int =
8484
"""
8585
return False
8686

87+
@classmethod
88+
def engine_new_payload_beacon_root(cls, block_number: int = 0, timestamp: int = 0) -> bool:
89+
"""
90+
At genesis, payloads do not have a parent beacon block root.
91+
"""
92+
return False
93+
8794
@classmethod
8895
def get_reward(cls, block_number: int = 0, timestamp: int = 0) -> int:
8996
"""
@@ -278,7 +285,7 @@ def header_blob_gas_used_required(cls, block_number: int = 0, timestamp: int = 0
278285
return True
279286

280287
@classmethod
281-
def header_beacon_root_required(cls, block_number: int, timestamp: int) -> bool:
288+
def header_beacon_root_required(cls, block_number: int = 0, timestamp: int = 0) -> bool:
282289
"""
283290
Parent beacon block root is required starting from Cancun.
284291
"""

src/evm_transition_tool/tests/test_evaluate.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import json
1+
import json # noqa: D100
22
import os
33
from pathlib import Path
44
from shutil import which
@@ -64,7 +64,7 @@
6464
),
6565
],
6666
)
67-
def test_calc_state_root(
67+
def test_calc_state_root( # noqa: D103
6868
t8n: TransitionTool,
6969
fork: Fork,
7070
alloc: Dict,
@@ -81,7 +81,7 @@ class TestEnv:
8181

8282
@pytest.mark.parametrize("evm_tool", [GethTransitionTool])
8383
@pytest.mark.parametrize("binary_arg", ["no_binary_arg", "path_type", "str_type"])
84-
def test_evm_tool_binary_arg(evm_tool, binary_arg):
84+
def test_evm_tool_binary_arg(evm_tool, binary_arg): # noqa: D103
8585
if binary_arg == "no_binary_arg":
8686
evm_tool().version()
8787
return
@@ -100,7 +100,7 @@ def test_evm_tool_binary_arg(evm_tool, binary_arg):
100100

101101
@pytest.mark.parametrize("t8n", [GethTransitionTool()])
102102
@pytest.mark.parametrize("test_dir", os.listdir(path=FIXTURES_ROOT))
103-
def test_evm_t8n(t8n: TransitionTool, test_dir: str) -> None:
103+
def test_evm_t8n(t8n: TransitionTool, test_dir: str) -> None: # noqa: D103
104104
alloc_path = Path(FIXTURES_ROOT, test_dir, "alloc.json")
105105
txs_path = Path(FIXTURES_ROOT, test_dir, "txs.json")
106106
env_path = Path(FIXTURES_ROOT, test_dir, "env.json")
@@ -125,5 +125,6 @@ def test_evm_t8n(t8n: TransitionTool, test_dir: str) -> None:
125125
),
126126
)
127127
print(result)
128+
print(expected.get("result"))
128129
assert result_alloc == expected.get("alloc")
129130
assert result == expected.get("result")

0 commit comments

Comments
 (0)