Skip to content

fix(tests) fix ported quadratic complexity tests#2784

Merged
danceratopz merged 3 commits intoethereum:forks/amsterdamfrom
danceratopz:fix-ported-quadratic-complexity
Apr 30, 2026
Merged

fix(tests) fix ported quadratic complexity tests#2784
danceratopz merged 3 commits intoethereum:forks/amsterdamfrom
danceratopz:fix-ported-quadratic-complexity

Conversation

@danceratopz
Copy link
Copy Markdown
Member

🗒️ Description

These tests were failing to fill; they are marked as slow, so not tested in CI.

This was discovered while trying to release from https://github.com/ethereum/execution-specs/tree/devnets/snobal/5 - cherry-picked from fd56c5d

🔗 Related Issues or PRs

N/A.

✅ Checklist

  • All: Ran fast static checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:
    just 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).

Cute Animal Picture

image

Three of these tests embed the runtime caller address directly in
their target contract's bytecode. The expected post hashed in a
literal hex string of the bytecode that hardcoded the pre-dynamic
EOA address (e.g. \`0xd9b97c712eb…\`), so once \`pre.fund_eoa()\`
started picking addresses dynamically the deployed code no longer
matched the expected hex. Hoist the bytecode into a \`target_code\`
variable used both at deploy time and as the expected \`code\`, so
the address baked in via \`Op.CALL(address=addr, …)\` is whatever
\`addr\` resolves to at fill time:

- \`test_call50000\`
- \`test_callcode50000\`
- \`test_call20_kbytes_contract50_2\`

\`test_quadratic_complexity_solidity_call_data_copy\` had a
different drift: its post asserted empty storage on \`contract_0\`,
but the success path (\`g=1\`, 250M gas) commits \`SSTORE(0, 50000)\`
before entering the loop. Make the expected storage \`g\`-conditional
so \`g=0\` (OOG) keeps an empty \`storage\` and \`g=1\` records slot 0.
@danceratopz danceratopz added C-bug Category: this is a bug, deviation, or other problem A-tests Area: Consensus tests. labels Apr 30, 2026
@danceratopz danceratopz requested a review from leolara April 30, 2026 07:42
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.17%. Comparing base (bf9dbb4) to head (eafa8b0).

Additional details and impacted files
@@               Coverage Diff                @@
##           forks/amsterdam    #2784   +/-   ##
================================================
  Coverage            88.17%   88.17%           
================================================
  Files                  577      577           
  Lines                35659    35659           
  Branches              3490     3490           
================================================
  Hits                 31442    31442           
  Misses                3654     3654           
  Partials               563      563           
Flag Coverage Δ
unittests 88.17% <ø> (ø)

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.

@leolara
Copy link
Copy Markdown
Member

leolara commented Apr 30, 2026

@danceratopz we need to add the @manually-enhanced in the docstring at the top level of the file, to avoid the script overwritting these fixes.

I am also going to apply these changes to #2783

@leolara
Copy link
Copy Markdown
Member

leolara commented Apr 30, 2026

Like here:

@manually-enhanced: Do not overwrite. This test has been manually reviewed and

leolara added a commit to leolara/execution-specs that referenced this pull request Apr 30, 2026
…ly-enhanced

The four post-state corrections cherry-picked from PR ethereum#2784 should not be
overwritten the next time `tests/ported_static/` is regenerated by
`scripts/filler_to_python`. Add the `@manually-enhanced` marker to each
docstring so the regenerator skips them.
@danceratopz
Copy link
Copy Markdown
Member Author

Thanks a lot for the review and handling @manually-enhanced @leolara!

@danceratopz
Copy link
Copy Markdown
Member Author

Ah I guess I should cherry-pick 1b581e8 across here.

…ly-enhanced

The four post-state corrections cherry-picked from PR ethereum#2784 should not be
overwritten the next time `tests/ported_static/` is regenerated by
`scripts/filler_to_python`. Add the `@manually-enhanced` marker to each
docstring so the regenerator skips them.
@danceratopz danceratopz merged commit e4c43d6 into ethereum:forks/amsterdam Apr 30, 2026
18 checks passed
leolara added a commit that referenced this pull request May 5, 2026
* chore(ported_static): sync from forks/amsterdam, preserving snøbal/4 changes

Sync 1467 ported_static test files from origin/forks/amsterdam (e7043cc)
to pick up upstream test maintenance, notably PR #2695 "use dynamic
addresses in ported static tests". Files modified on snøbal/4 since the
merge-base with forks/amsterdam (606) and files marked @manually-enhanced
(14) are preserved.

Also delete tests/ported_static/stTimeConsuming/test_sstore_combinations_initial.py,
removed upstream in PR #2695 (deprecated by the *_paris.py splits that
already live in the directory).

* chore(ported_static): prune amsterdam_skip_list to 455 currently-failing entries

The list previously contained 5469 entries — many for tests that pass on
snøbal/4 today (test source updated, addresses now dynamic, etc.) or for
tests that no longer exist after PR #2695's regeneration. Empirically:

- With the bloated list: 17199 passed, 1731 skipped, 0 failed.
- With no list:          17565 passed, 0 skipped, 1365 failed (gas).
- After this prune:      17565 passed, 1365 skipped, 0 failed.

The remaining 455 entries are exactly those that match a currently-
failing fork_Amsterdam parametrization (still legitimate
InsufficientTransactionGasError under EIP-8037's two-dimensional gas
model). Section-header counts updated to reflect the actual contents.

* fix(tests): correct stQuadraticComplexityTest post-state expectations

Three of these tests embed the runtime caller address directly in
their target contract's bytecode. The expected post hashed in a
literal hex string of the bytecode that hardcoded the pre-dynamic
EOA address (e.g. \`0xd9b97c712eb…\`), so once \`pre.fund_eoa()\`
started picking addresses dynamically the deployed code no longer
matched the expected hex. Hoist the bytecode into a \`target_code\`
variable used both at deploy time and as the expected \`code\`, so
the address baked in via \`Op.CALL(address=addr, …)\` is whatever
\`addr\` resolves to at fill time:

- \`test_call50000\`
- \`test_callcode50000\`
- \`test_call20_kbytes_contract50_2\`

\`test_quadratic_complexity_solidity_call_data_copy\` had a
different drift: its post asserted empty storage on \`contract_0\`,
but the success path (\`g=1\`, 250M gas) commits \`SSTORE(0, 50000)\`
before entering the loop. Make the expected storage \`g\`-conditional
so \`g=0\` (OOG) keeps an empty \`storage\` and \`g=1\` records slot 0.

* chore(tests): remove unrequired `# noqa: F841`

* chore(ported_static): mark stQuadraticComplexityTest fixes as @manually-enhanced

The four post-state corrections cherry-picked from PR #2784 should not be
overwritten the next time `tests/ported_static/` is regenerated by
`scripts/filler_to_python`. Add the `@manually-enhanced` marker to each
docstring so the regenerator skips them.

---------

Co-authored-by: danceratopz <danceratopz@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tests Area: Consensus tests. C-bug Category: this is a bug, deviation, or other problem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants