Skip to content

Conversation

@fselmo
Copy link
Contributor

@fselmo fselmo commented Dec 31, 2025

πŸ—’οΈ Description

Port STATICCALL tests with zero and non-zero value to precompiles. This has the added bonus of extending the precompiles, parametrized per fork, via pytest.mark.with_all_precompiles.

πŸ”— 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 adding an entry to CHANGELOG.md.
  • 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-->

@fselmo fselmo added C-test Category: test C-feat Category: an improvement or new feature A-test-tests Area: tests for packages/testing and removed C-test Category: test labels Dec 31, 2025
@fselmo fselmo force-pushed the feat/port-static-context-tests branch from 26081cb to d0fab3d Compare December 31, 2025 21:35
@fselmo fselmo marked this pull request as ready for review December 31, 2025 21:38
@codecov
Copy link

codecov bot commented Dec 31, 2025

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 86.16%. Comparing base (c14e9c9) to head (b56350b).
⚠️ Report is 2 commits behind head on forks/amsterdam.

Additional details and impacted files
@@                 Coverage Diff                 @@
##           forks/amsterdam    #1960      +/-   ##
===================================================
+ Coverage            86.07%   86.16%   +0.09%     
===================================================
  Files                  599      599              
  Lines                39527    39527              
  Branches              3780     3780              
===================================================
+ Hits                 34021    34059      +38     
+ Misses                4872     4847      -25     
+ Partials               634      621      -13     
Flag Coverage Ξ”
unittests 86.16% <ΓΈ> (+0.09%) ⬆️

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.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@LouisTsai-Csie LouisTsai-Csie self-requested a review January 1, 2026 12:25
Copy link
Collaborator

@LouisTsai-Csie LouisTsai-Csie left a comment

Choose a reason for hiding this comment

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

Leave some comments! It is really crazy that old test is written in yml format.

fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 2, 2026
Carsons-Eels pushed a commit to Carsons-Eels/execution-specs that referenced this pull request Jan 6, 2026
* chore(docs): add benchmark marker to test case ref.

* chore(docs): update benchmark conftest instead.
@danceratopz danceratopz self-assigned this Jan 7, 2026
fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 9, 2026
- Inspired by comment: ethereum#1960 (comment)
- Split the unreadable bytecode test into one where the `evm_bytes`` output
  is compared to it and asserted (to make the original more readable) and
  another test from the comment where we can parametrize with all precompiles
  as well as with call_value = [0, 1] (0 and nonzero).
fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 9, 2026
@fselmo fselmo force-pushed the feat/port-static-context-tests branch from 05fa6e8 to 9d5e0f4 Compare January 9, 2026 20:20
fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 9, 2026
- Inspired by comment: ethereum#1960 (comment)
- Split the unreadable bytecode test into one where the `evm_bytes`` output
  is compared to it and asserted (to make the original more readable) and
  another test from the comment where we can parametrize with all precompiles
  as well as with call_value = [0, 1] (0 and nonzero).
@fselmo

This comment was marked as outdated.

Copy link
Member

@marioevz marioevz left a comment

Choose a reason for hiding this comment

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

Some small comments that can be applied to all test functions in the PR. Thanks!

"80818283600160025af15050"
)

target_code = (
Copy link
Member

Choose a reason for hiding this comment

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

We should also use Conditional here to have more readable code, no need to try to match the exact original bytecode IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The goal here was to preserve the original test and to get it in our API so it is more readable. We then created a version of the test, test_staticcall_reentrant_call_with_value_to_precompile(), that is more readable and does a similar thing while extending coverage.

If we don't care about keeping the exact bytecode that caught a bug once upon a time, then we can keep the variant of the test that is most readable. To be clear, I would prefer to keep the actual bytecode for added safety and for historical reasons. But if we don't want to try to match the original bytecode, I think we can remove this test case entirely.

@fselmo fselmo marked this pull request as draft January 12, 2026 22:45
fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 19, 2026
fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 19, 2026
- Inspired by comment: ethereum#1960 (comment)
- Split the unreadable bytecode test into one where the `evm_bytes`` output
  is compared to it and asserted (to make the original more readable) and
  another test from the comment where we can parametrize with all precompiles
  as well as with call_value = [0, 1] (0 and nonzero).
fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 19, 2026
@fselmo fselmo force-pushed the feat/port-static-context-tests branch from dbad28a to 1b335b2 Compare January 19, 2026 15:49
Copy link
Contributor Author

@fselmo fselmo left a comment

Choose a reason for hiding this comment

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

@marioevz I applied all the changes you suggested here. I opted to remove the first test entirely since we don't care about preserving the actual bytecode. We should carefully review to make sure it's covering the same case as the original test if this is the route we want to take.


edit: I had to add an update to the pytest.param() support for valid_from() because docs pulls in all forks and this was erring with the marker for with_all_valid_precompiles in conjunction with valid_from() being in the params. It wouldn't have this fork range updated and some forks don't support precompiles at all. It's a minor change here, but we should make sure it is reviewed appropriately.

"80818283600160025af15050"
)

target_code = (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The goal here was to preserve the original test and to get it in our API so it is more readable. We then created a version of the test, test_staticcall_reentrant_call_with_value_to_precompile(), that is more readable and does a similar thing while extending coverage.

If we don't care about keeping the exact bytecode that caught a bug once upon a time, then we can keep the variant of the test that is most readable. To be clear, I would prefer to keep the actual bytecode for added safety and for historical reasons. But if we don't want to try to match the original bytecode, I think we can remove this test case entirely.

fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 19, 2026
@fselmo fselmo force-pushed the feat/port-static-context-tests branch from 1b335b2 to a3ae654 Compare January 19, 2026 15:54
@fselmo fselmo marked this pull request as ready for review January 19, 2026 15:54
fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 19, 2026
@fselmo fselmo force-pushed the feat/port-static-context-tests branch from a3ae654 to 8b9e8b9 Compare January 19, 2026 16:26
@fselmo

This comment was marked as outdated.

fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 19, 2026
@fselmo fselmo force-pushed the feat/port-static-context-tests branch from 8b9e8b9 to 0ad7061 Compare January 19, 2026 16:38
Port STATICCALL tests with zero and non-zero value to precompiles
- Inspired by comment: ethereum#1960 (comment)
- Split the unreadable bytecode test into one where the `evm_bytes`` output
  is compared to it and asserted (to make the original more readable) and
  another test from the comment where we can parametrize with all precompiles
  as well as with call_value = [0, 1] (0 and nonzero).
fselmo added a commit to fselmo/execution-specs that referenced this pull request Jan 20, 2026
@fselmo fselmo force-pushed the feat/port-static-context-tests branch from 0ad7061 to 46de4f2 Compare January 20, 2026 21:08
@fselmo fselmo force-pushed the feat/port-static-context-tests branch from 46de4f2 to 3c778f0 Compare January 20, 2026 21:46
@fselmo
Copy link
Contributor Author

fselmo commented Jan 20, 2026

I also added BAL expectations here since these were of interest to BALs originally, which is why it caught my eye to port them in the first place.

More recently (since this PR was opened), geth caught an implementation issue because of these static tests (relevant conversation here).

@fselmo fselmo force-pushed the feat/port-static-context-tests branch from 3c778f0 to b2c2f74 Compare January 20, 2026 22:27
Copy link
Member

@marioevz marioevz left a comment

Choose a reason for hiding this comment

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

LGTM. I made one last push to change the test types to StateTest while preserving the BAL checks.

@marioevz marioevz dismissed LouisTsai-Csie’s stale review January 21, 2026 21:27

Comments have been addressed, and we have a separate newer review.

@fselmo fselmo merged commit f1ba2b1 into ethereum:forks/amsterdam Jan 21, 2026
16 checks passed
@fselmo fselmo deleted the feat/port-static-context-tests branch January 21, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-test-tests Area: tests for packages/testing C-feat Category: an improvement or new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants