refactor(test-tests): migrate precompile gas costs to fork.gas_costs()#2192
Merged
marioevz merged 2 commits intoethereum:forks/amsterdamfrom Feb 12, 2026
Merged
Conversation
61 tasks
1a11b10 to
0b3d925
Compare
…s()` Add precompile gas cost constants to the GasCosts dataclass and set values per-fork so tests use dynamic gas costs instead of hardcoded Spec.* constants. This enables EIP-7904 repricing with a single-file change.
0b3d925 to
4dc9b25
Compare
Contributor
Author
|
I'm thinking of creating a similiar abstraction here called: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/amsterdam #2192 +/- ##
================================================
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:
|
7 tasks
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 precompile gas costs from hardcoded
Spec.*constants in test files to dynamicfork.gas_costs().G_PRECOMPILE_*lookups.This is a pure refactor with no functional change, all test fixtures produce identical output (verified via fill + fixture hash comparison).
The benefit is maintainability: when EIP-7904 reprices precompiles (e.g., ECADD 150 to 314, BLS12_G1ADD 375 to 643, POINT_EVALUATION 50000 to 89363), only
gas_costs.pyandforks.pyneed updating instead of every test file.GasCosts dataclass additions
New constants added with
default=0, set per-fork:G_PRECOMPILE_ECRECOVERG_PRECOMPILE_SHA256_BASEG_PRECOMPILE_SHA256_WORDG_PRECOMPILE_RIPEMD160_BASEG_PRECOMPILE_RIPEMD160_WORDG_PRECOMPILE_IDENTITY_BASEG_PRECOMPILE_IDENTITY_WORDG_PRECOMPILE_BLAKE2F_PER_ROUNDG_PRECOMPILE_POINT_EVALUATIONG_PRECOMPILE_BLS_G1ADDG_PRECOMPILE_BLS_G1MULG_PRECOMPILE_BLS_G1MAPG_PRECOMPILE_BLS_G2ADDG_PRECOMPILE_BLS_G2MULG_PRECOMPILE_BLS_G2MAPG_PRECOMPILE_BLS_PAIRING_BASEG_PRECOMPILE_BLS_PAIRING_PER_PAIRG_PRECOMPILE_P256VERIFYFiles migrated
tests/cancun/eip4844_blobs/test_point_evaluation_precompile.pytests/cancun/eip4844_blobs/test_point_evaluation_precompile_gas.pytests/prague/eip2537_bls_12_381_precompiles/conftest.py+spec.pytests/osaka/eip7951_p256verify_precompiles/conftest.py+test_p256verify.pySpec.*references in@pytest.mark.parametrizedecorators are kept sinceforkis unavailable at module-load time. Beacon roots (Spec.BEACON_ROOTS_CALL_GAS) is skipped — it's a system contract, not a precompile.🔗 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