diff --git a/src/ethereum_spec_tools/new_fork/builder.py b/src/ethereum_spec_tools/new_fork/builder.py index 551d265040..1ca9bd9b81 100644 --- a/src/ethereum_spec_tools/new_fork/builder.py +++ b/src/ethereum_spec_tools/new_fork/builder.py @@ -330,7 +330,7 @@ def __init__( self.output = Path(template_path).parent # Try to make a sane guess for the activation criteria. - if found is forks[-1]: + if found is forks[-1] or isinstance(found.criteria, Unscheduled): order_index = 0 # check template fork's criteria and bump order_index if needed diff --git a/tests/json_infra/test_tools_new_fork.py b/tests/json_infra/test_tools_new_fork.py index 0160c0a782..42843e5c24 100644 --- a/tests/json_infra/test_tools_new_fork.py +++ b/tests/json_infra/test_tools_new_fork.py @@ -5,10 +5,21 @@ from pathlib import Path from tempfile import TemporaryDirectory +import pytest + +from ethereum_spec_tools.forks import Hardfork from ethereum_spec_tools.new_fork.cli import main as new_fork -def test_end_to_end() -> None: +@pytest.mark.parametrize( + "template_fork", + [ + Hardfork.discover()[-1].short_name, + "osaka", + ], + ids=lambda tf: f"{tf}", +) +def test_end_to_end(template_fork: str) -> None: """ Test that the ethereum-spec-new-fork CLI tool creates a fork from a template, correctly modifying names, blob parameters, and imports. @@ -22,7 +33,7 @@ def test_end_to_end() -> None: "--new-fork", "e2e_fork", "--template-fork", - "osaka", + template_fork, "--target-blob-gas-per-block", "199", "--blob-base-fee-update-fraction", @@ -47,7 +58,7 @@ def test_end_to_end() -> None: assert "FORK_CRITERIA = ByTimestamp(7)" in source assert "E2E Fork" in source - assert "Osaka" not in source + assert template_fork.capitalize() not in source with (fork_dir / "vm" / "gas.py").open("r") as f: source = f.read()