Skip to content

feat(tests): port Cancun static tests and delete originals#2481

Draft
chfast wants to merge 3 commits intoethereum:forks/amsterdamfrom
chfast:port-static-Cancun
Draft

feat(tests): port Cancun static tests and delete originals#2481
chfast wants to merge 3 commits intoethereum:forks/amsterdamfrom
chfast:port-static-Cancun

Conversation

@chfast
Copy link
Copy Markdown
Member

@chfast chfast commented Mar 11, 2026

🗒️ Description

Add ported_from markers to existing Python tests that cover the former Cancun static test files, and add new tests to cover gaps identified during review.

Ported-from markers added to existing test functions for:

  • stEIP1153_transientStorage: transStorageOKFiller.yml, 10_revertUndoesStoreAfterReturnFiller.yml, 14_revertAfterNestedStaticcallFiller.yml, transStorageResetFiller.yml
  • stEIP4844_blobtransactions: emptyBlobhashListFiller.yml, wrongBlobhashVersionFiller.yml, createBlobhashTxFiller.yml, opcodeBlobhashOutOfRangeFiller.yml, opcodeBlobhBoundsFiller.yml
  • stEIP5656_MCOPY: MCOPYFiller.yml, MCOPY_copy_costFiller.yml, MCOPY_memory_expansion_costFiller.yml
  • stChainId: chainIdFiller.json

New tests to cover gaps in the ported static tests:

  • STATICCALL_PROPAGATES_STATIC_FLAG_THROUGH_CALL — STATICCALL's static flag propagates through a nested CALL, preventing TSTORE (ports 14_revertAfterNestedStaticcallFiller.yml)
  • test_revert_in_callback_chain — revert propagation across contract boundaries with CALL/CALLCODE/DELEGATECALL and REVERT/INVALID/STOP terminations (ports transStorageResetFiller.yml)
  • test_tstore_recursive_call — transient storage persistence across recursive call depth with different call opcodes (ports recursive/deep patterns from transStorageOKFiller.yml)
  • Word-boundary MCOPY copy cost vectors (length=31, 32, 33 with aligned/unaligned source offsets) added to test_mcopy_memory_expansion

🔗 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.
  • Ported Tests: All converted JSON/YML tests from ethereum/tests or tests/static have been assigned @ported_from marker.

Cute Animal Picture

🐬

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.02%. Comparing base (8a0fc69) to head (262ae8b).
⚠️ Report is 4 commits behind head on forks/amsterdam.

Additional details and impacted files
@@                 Coverage Diff                 @@
##           forks/amsterdam    #2481      +/-   ##
===================================================
+ Coverage            85.97%   86.02%   +0.04%     
===================================================
  Files                  599      599              
  Lines                36916    36916              
  Branches              3771     3771              
===================================================
+ Hits                 31738    31756      +18     
+ Misses                4560     4551       -9     
+ Partials               618      609       -9     
Flag Coverage Δ
unittests 86.02% <ø> (+0.04%) ⬆️

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 March 12, 2026 10:19
chfast added a commit to chfast/execution-specs that referenced this pull request Mar 12, 2026
Add pr= link for ethereum#2481 to all Cancun ported_from markers.
Add pr= link for ethereum#2478 to chainid ported_from marker.
Copy link
Copy Markdown
Contributor

@spencer-tb spencer-tb left a comment

Choose a reason for hiding this comment

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

Thanks for adding this! Some potential gaps below after chatting with claude, they look reasonable to me:

transStorageResetFiller.yml to test_tstore_clear_after_deployment_tx:

  • I think this mapping is wrong. The YAML and the python test different things I believe. The YAML is testing that revert propagation works correctly when the call chain crosses contract boundaries with different call opcodes. I think we should remove this and port this YAML fully by adding a test function test_revert_in_callback_chain to tests/cancun/eip1153_tstore/test_tstorage_reentrancy_contexts.py with the ported marker.

14_revertAfterNestedStaticcallFiller.yml to test_subcall:

  • The existing STATICCALL_CANT_CALL_TSTORE case tests direct TSTORE in a static callee, but the YAML tests that the static flag propagates through a nested CALL, i.e STATICCALL to CALL to TSTORE fails. I think we should remove the ported from marker here and instead add a new case to ReentrancyTestCases in test_tstorage_reentrancy_contexts.py, something like STATICCALL_PROPAGATES_STATIC_FLAG_THROUGH_CALL, adding the ported marker to test_reentrant_call.

transStorageOKFiller.yml to test_subcall:

  • test_subcall covers the basic call-type semantics (CALLCODE/DELEGATECALL, isolation via CALL, STATICCALL restrictions), which maps to the inheritTrans() and staticCall() scenarios in the YAML. But the YAML also has 12 scenarios testing recursive call chains (sumTo, callcodeSumTo, delegateSumTo), intervening contracts (callbackSum), binary tree recursion (binTree, delegateBinTree), and deep mixed call stacks (deepCall). These multi level scenarios aren't covered. I think we should add new tests for the recursive/deep patterns in test_tstorage_reentrancy_contexts.py.

MCOPY_copy_costFiller.yml to test_mcopy_memory_expansion:

  • The YAML focuses on copy cost scaling with 31 word-boundary vectors (size 31/32/33, etc.), while the python test focuses on memory expansion cost. The marker is a reasonable partial match. I think specific word boundary copy cost vectors aren't replicated. Lower risk, but we could consider adding a few word boundary parametrized cases (length=31, 32, 33) to test_mcopy_memory_expansion.

@chfast chfast marked this pull request as draft March 12, 2026 11:47
chfast added 3 commits March 16, 2026 14:08
Port MCOPY_memory_hashFiller.yml as a new test_mcopy_repeated test
that verifies memory hash consistency after performing the same MCOPY
twice: idempotent for non-overlapping copies, different for
overlapping forward/backward moves.

Add @pytest.mark.ported_from markers to existing tests that already
cover the remaining 12 static files across EIP-1153 (transient
storage), EIP-4844 (blob transactions), and EIP-5656 (MCOPY).

Delete the entire tests/static/state_tests/Cancun/ directory.
Add pr= link for ethereum#2481 to all Cancun ported_from markers.
Add pr= link for ethereum#2478 to chainid ported_from marker.
- Remove wrong transStorageResetFiller mapping from
  test_tstore_clear_after_deployment_tx (tests different behavior)
- Remove 14_revertAfterNestedStaticcallFiller from test_subcall
- Add STATICCALL_PROPAGATES_STATIC_FLAG_THROUGH_CALL case to
  ReentrancyTestCases (static flag propagates through nested CALL)
- Add test_revert_in_callback_chain for cross-contract revert
  propagation with CALL/CALLCODE/DELEGATECALL and REVERT/INVALID/STOP
- Add test_tstore_recursive_call for transient storage persistence
  across recursive call depth with different call opcodes
- Add word-boundary MCOPY copy cost vectors (length=31,32,33) with
  aligned and unaligned source offsets
@chfast chfast force-pushed the port-static-Cancun branch from 0b06683 to afda208 Compare March 16, 2026 13:09
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