Skip to content

refactor(test-tests): migrate cancun to osaka gas costs to bytecode.gas_cost(fork)#2191

Merged
marioevz merged 5 commits intoethereum:forks/amsterdamfrom
spencer-tb:chore/migrate-gas-costs-cancun-to-osaka
Feb 11, 2026
Merged

refactor(test-tests): migrate cancun to osaka gas costs to bytecode.gas_cost(fork)#2191
marioevz merged 5 commits intoethereum:forks/amsterdamfrom
spencer-tb:chore/migrate-gas-costs-cancun-to-osaka

Conversation

@spencer-tb
Copy link
Contributor

@spencer-tb spencer-tb commented Feb 11, 2026

🗒️ Description

Migrate Cancun, Prague, and Osaka test files from manual fork.gas_costs() / hardcoded Spec constants to bytecode.gas_cost(fork).

This is a pure refactor with no functional change, all exact gas-boundary test fixtures produce identical output (verified via fixture hash comparison).

The benefit is maintainability: tests now declare intent via opcode metadata (e.g., address_warm=False, key_warm=True) and delegate gas calculation to the framework's opcode_gas_map(), so future gas schedule changes only need updating in one place.

Files migrated:

  • tests/cancun/eip1153_tstore/test_basic_tload.py
  • tests/cancun/eip1153_tstore/test_tstorage.py
  • tests/cancun/eip1153_tstore/test_tstorage_execution_contexts.py
  • tests/cancun/eip4844_blobs/test_blobhash_opcode.py
  • tests/cancun/eip7516_blobgasfee/test_blobgasfee_opcode.py
  • tests/prague/eip7702_set_code_tx/test_eip_mainnet.py
  • tests/prague/eip7702_set_code_tx/test_gas.py
  • tests/prague/eip7702_set_code_tx/test_set_code_txs.py
  • tests/prague/eip7702_set_code_tx/test_set_code_txs_2.py
  • tests/prague/eip7623_increase_calldata_cost/test_refunds.py
  • tests/osaka/eip7823_modexp_upper_bounds/conftest.py
  • tests/osaka/eip7825_transaction_gas_limit_cap/test_tx_gas_limit.py
  • tests/osaka/eip7883_modexp_gas_increase/conftest.py
  • tests/osaka/eip7883_modexp_gas_increase/test_modexp_thresholds_transition.py

Remaining fork.gas_costs() references are intentional:

  • Refund constants (R_STORAGE_CLEAR, R_AUTHORIZATION_EXISTING_AUTHORITY), not opcode costs
  • Transaction-level costs (G_TX_DATA_FLOOR_TOKEN_COST, G_ACCESS_LIST_ADDRESS, G_ACCESS_LIST_STORAGE), not expressible via bytecode.gas_cost(fork)

🔗 Related Issues or PRs

Partially fixes #2049.

✅ 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).

Cute Animal Picture

kakuna

@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.07%. Comparing base (a82b1f6) to head (b815d0c).
⚠️ Report is 4 commits behind head on forks/amsterdam.

Additional details and impacted files
@@               Coverage Diff                @@
##           forks/amsterdam    #2191   +/-   ##
================================================
  Coverage            86.07%   86.07%           
================================================
  Files                  599      599           
  Lines                39472    39472           
  Branches              3780     3780           
================================================
  Hits                 33977    33977           
  Misses                4862     4862           
  Partials               633      633           
Flag Coverage Δ
unittests 86.07% <ø> (ø)

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.

@marioevz marioevz self-requested a review February 11, 2026 17:03
@spencer-tb spencer-tb changed the title refactor(test-tests): migrate cancun to osaka gas costs to bytecode.gas_cost(fork) refactor(test-tests): migrate cancun to osaka gas costs to bytecode.gas_cost(fork) Feb 11, 2026
@marioevz
Copy link
Member

Have not reviewed yet but did a push of a commit to remove the Bytecode wrapping.

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.

Excellent, thanks!

@marioevz marioevz merged commit be3678d into ethereum:forks/amsterdam Feb 11, 2026
15 checks passed
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-refactor Category: refactor P-medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(test-tests): migrate tests from fork.gas_costs to bytecode.gas_cost(fork)

3 participants