Repository navigation
evm: Refactor the state-access cost constants - #1732
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The refactoring consistently preserves existing gas-cost calculations and leaves no unresolved issues.
Review effort: Balanced
Findings: None
What changed in this PR
Refactors state-access gas constants to clearer EIP terminology without changing behavior.
Changes:
- Renames warm and cold account/storage access constants.
- Centralizes SLOAD and SSTORE cold surcharges.
- Restricts CALL-related constants to local scope.
| File | Description |
|---|---|
lib/evmone/instructions.hpp |
Uses renamed account-access constants. |
lib/evmone/instructions_traits.hpp |
Defines renamed and derived access-cost constants. |
lib/evmone/instructions_storage.cpp |
Sources storage cold costs from revision data. |
lib/evmone/instructions_calls.cpp |
Updates constants and narrows CALL constant scope. |
test/unittests/state_transition_eip8037_state_gas_test.cpp |
Updates the renamed test constant reference. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
- Rename to the EIP-8038 parameter names: WARM_ACCESS, COLD_STORAGE_ACCESS and COLD_ACCOUNT_ACCESS. The EIP-2929 names are misleading: WARM_STORAGE_READ_COST is charged for warm account accesses too (BALANCE, *CALL, EXT*), not only storage reads. - Rename the derived constant to ADDITIONAL_COLD_ACCOUNT_ACCESS and give its storage counterpart, so far a local in SLOAD, the name ADDITIONAL_COLD_STORAGE_ACCESS in the instruction traits. - Drop the redundant instr:: qualification; every use of these constants is already inside evmone::instr::core. - Move CALL_VALUE_COST and ACCOUNT_CREATION_COST out of the global namespace into the anonymous one. - Read the SSTORE cold surcharge from the per-revision storage cost table instead of hardcoding it at the use site. No behaviour change.
chfast
force-pushed
the
evm/access-cost-refactor
branch
from
September 22, 2026 10:02
f6fbc68 to
69790f5
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1732 +/- ##
==========================================
- Coverage 97.99% 97.99% -0.01%
==========================================
Files 181 181
Lines 16762 16759 -3
Branches 3827 3827
==========================================
- Hits 16426 16423 -3
Misses 249 249
Partials 87 87
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
No behaviour change.