Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ethereum_spec_tools/new_fork/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 14 additions & 3 deletions tests/json_infra/test_tools_new_fork.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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",
Expand All @@ -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()
Expand Down
Loading