Skip to content

refactor(test-forks): Remove block_number/timestamp from all methods#2442

Merged
marioevz merged 13 commits into
ethereum:forks/amsterdamfrom
marioevz:refactor-fork-methods
Mar 24, 2026
Merged

refactor(test-forks): Remove block_number/timestamp from all methods#2442
marioevz merged 13 commits into
ethereum:forks/amsterdamfrom
marioevz:refactor-fork-methods

Conversation

@marioevz

@marioevz marioevz commented Mar 7, 2026

Copy link
Copy Markdown
Member

🗒️ Description

Removes block_number and timestamp from all fork methods. In its place, a TransitionFork is now introduced which can contain two forks (perhaps more in the future) and has to be resolved before accessing any of the forks methods.

This forces the tester to resolve the fork before requesting properties from it, instead of always passing block_number=0, timestamp=0.

The affected tests are the ones that use the valid_at_transition_to marker, since they now have to declare the fork parameter as fork: TransitionFork instead of the usual fork: Fork.

🔗 Related Issues or PRs

N/A.

✅ Checklist

  • All: Ran fast tox checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:
    uvx tox -e static
  • All: PR title adheres to the repo standard - it will be used as the squash commit message and should start type(scope):.
  • All: Considered updating the online docs in the ./docs/ directory.
  • All: Set appropriate labels for the changes (only maintainers can apply labels).
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.
  • Tests: For PRs implementing a missed test case, update the post-mortem document to add an entry the list.
  • Ported Tests: All converted JSON/YML tests from ethereum/tests or tests/static have been assigned @ported_from marker.

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@marioevz

marioevz commented Mar 9, 2026

Copy link
Copy Markdown
Member Author

@spencer-tb Added automatic ruleset generation, commit 3499a4a contains a unit test that can be executed with uv run pytest src/execution_testing/cli/pytest_commands/plugins/consume/simulators/helpers/ruleset.py -vv to verify that the newly generated ruleset and the previous one match.

@codecov

codecov Bot commented Mar 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.35%. Comparing base (125ed98) to head (c43098d).

Additional details and impacted files
@@               Coverage Diff                @@
##           forks/amsterdam    #2442   +/-   ##
================================================
  Coverage            86.35%   86.35%           
================================================
  Files                  599      599           
  Lines                36904    36904           
  Branches              3771     3771           
================================================
  Hits                 31868    31868           
  Misses                4485     4485           
  Partials               551      551           
Flag Coverage Δ
unittests 86.35% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fselmo fselmo self-assigned this Mar 10, 2026

@fselmo fselmo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick first pass @marioevz. Will take another pass tomorrow 👀

Comment thread packages/testing/src/execution_testing/forks/base_fork.py Outdated
Comment thread packages/testing/src/execution_testing/forks/base_fork.py Outdated
Comment thread packages/testing/src/execution_testing/forks/transition_base_fork.py Outdated
Comment thread packages/testing/src/execution_testing/forks/transition_base_fork.py Outdated
Comment thread docs/writing_tests/fork_methods.md Outdated
@marioevz
marioevz force-pushed the refactor-fork-methods branch from 241d347 to 47715d8 Compare March 12, 2026 21:00
@marioevz

Copy link
Copy Markdown
Member Author

@fselmo I've fixed the comments and rebased, it's ready for another pass :)

@marioevz
marioevz force-pushed the refactor-fork-methods branch from 47715d8 to c137ac7 Compare March 23, 2026 21:05
@fselmo

fselmo commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

@marioevz sorry I took too long here and it needed a rebase again. I see you're working on it now. I will do another pass here when CI stabilizes. Still some conflicts.

@marioevz
marioevz force-pushed the refactor-fork-methods branch from c137ac7 to e7eb0d4 Compare March 24, 2026 17:39
@marioevz
marioevz requested a review from fselmo March 24, 2026 17:50
@marioevz

Copy link
Copy Markdown
Member Author

@fselmo Finally got around to rebase and fix the conflicts, I think this is now ready :)

@fselmo fselmo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only found some remaining doc changes and minor docstring updates. Logic seems sound and lgtm checking the ruleset after the changes here. Going to approve but let's try to make these updates before merging. I'm not sure why some are not showing the proper diff but I think it's because it's in places where you didn't touch in the PR maybe 🤔.

Anyway, logic lgtm! nice refactor 👍🏼

Comment thread docs/writing_tests/fork_methods.md Outdated
Comment thread docs/writing_tests/fork_methods.md Outdated
Comment thread docs/writing_tests/fork_methods.md Outdated
Comment thread docs/writing_tests/fork_methods.md Outdated
Comment thread docs/writing_tests/fork_methods.md Outdated
Comment thread docs/writing_tests/fork_methods.md Outdated
Comment thread docs/writing_tests/fork_methods.md Outdated
Comment thread docs/writing_tests/fork_methods.md Outdated
Comment thread docs/writing_tests/fork_methods.md Outdated
Comment thread packages/testing/src/execution_testing/forks/base_fork.py Outdated
@marioevz
marioevz force-pushed the refactor-fork-methods branch from e7eb0d4 to c43098d Compare March 24, 2026 22:02
@marioevz
marioevz merged commit 21407ec into ethereum:forks/amsterdam Mar 24, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants