refactor(test-tests): migrate frontier to shanghai gas costs to bytecode.gas_cost(fork)#2188
Merged
marioevz merged 6 commits intoethereum:forks/amsterdamfrom Feb 11, 2026
Conversation
…s_cost(fork)` Migrate Frontier, Berlin, TangerineWhistle, and Shanghai test files from `fork.gas_costs()` / hardcoded constants to `bytecode.gas_cost(fork)` API. Files migrated: - tests/frontier/opcodes/test_call.py - tests/frontier/opcodes/test_call_and_callcode_gas_calculation.py - tests/berlin/eip2929_gas_cost_increases/test_precompile_warming.py - tests/berlin/eip2930_access_list/test_acl.py - tests/tangerine_whistle/eip150_operation_gas_costs/test_eip150_selfdestruct.py - tests/shanghai/eip3651_warm_coinbase/test_warm_coinbase.py - tests/shanghai/eip3860_initcode/test_initcode.py
49550c8 to
5bc2716
Compare
bytecode.gas_cost(fork)
61 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/amsterdam #2188 +/- ##
================================================
Coverage 86.07% 86.07%
================================================
Files 599 599
Lines 39472 39472
Branches 3780 3780
================================================
Hits 33977 33977
Misses 4862 4862
Partials 633 633
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
4 tasks
marioevz
approved these changes
Feb 11, 2026
Member
marioevz
left a comment
There was a problem hiding this comment.
Awesome change, thanks! The comments are just to remove the wrapping of Bytecode since you can directly do Op.SSTORE(...).gas_cost(fork) for example.
tests/berlin/eip2929_gas_cost_increases/test_precompile_warming.py
Outdated
Show resolved
Hide resolved
tests/berlin/eip2929_gas_cost_increases/test_precompile_warming.py
Outdated
Show resolved
Hide resolved
tests/berlin/eip2929_gas_cost_increases/test_precompile_warming.py
Outdated
Show resolved
Hide resolved
tests/tangerine_whistle/eip150_operation_gas_costs/test_eip150_selfdestruct.py
Outdated
Show resolved
Hide resolved
tests/tangerine_whistle/eip150_operation_gas_costs/test_eip150_selfdestruct.py
Outdated
Show resolved
Hide resolved
tests/tangerine_whistle/eip150_operation_gas_costs/test_eip150_selfdestruct.py
Outdated
Show resolved
Hide resolved
tests/tangerine_whistle/eip150_operation_gas_costs/test_eip150_selfdestruct.py
Outdated
Show resolved
Hide resolved
tests/tangerine_whistle/eip150_operation_gas_costs/test_eip150_selfdestruct.py
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🗒️ Description
Migrate remaining Frontier, Berlin, TangerineWhistle, and Shanghai test files from manual
fork.gas_costs()calculations tobytecode.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,value_transfer=True) and delegate gas calculation to the framework'sopcode_gas_map(), so future gas schedule changes only need updating in one place.Files migrated:
tests/frontier/opcodes/test_call.pytests/frontier/opcodes/test_call_and_callcode_gas_calculation.pytests/berlin/eip2929_gas_cost_increases/test_precompile_warming.pytests/berlin/eip2930_access_list/test_acl.pytests/tangerine_whistle/eip150_operation_gas_costs/test_eip150_selfdestruct.pytests/shanghai/eip3651_warm_coinbase/test_warm_coinbase.pytests/shanghai/eip3860_initcode/test_initcode.pyPre-Berlin hardcoded values (700 for Byzantium-Berlin CALL, 40 for Homestead CALL) are kept where the framework's
opcode_gas_mapdoesn't model pre-EIP-2929 costs. The remainingfork.gas_costs().G_CALL_STIPENDreference is intentional, it's a threshold check, not a gas cost. Per-word costs (G_INITCODE_WORD,G_KECCAK_256_WORD) are kept as-is since they aren't expressible viabytecode.gas_cost.🔗 Related Issues or PRs
Partially fixes #2049.
✅ Checklist
toxchecks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:uvx tox -e statictype(scope):.Cute Animal Picture