fix(l1): bump BAL fixtures to v5.6.1 and fix EIP-8037 state gas ordering#6447
Conversation
🤖 Kimi Code ReviewThis PR updates EIP-8037 (Amsterdam/BAL) gas accounting logic and test fixtures. The changes are structurally sound and fix consensus-critical gas limit validation bugs. Correctness & Consensus
Potential IssuesError Message Compatibility
If the mapper wasn't updated, EELS tests will fail despite valid logic. Minor Suggestions
// EIP-8037: Final block validation ensures max(regular, state) <= gas_limitSecurity Assessment
SummaryThe PR correctly implements EIP-8037's gas accounting separation. The fixture update to v5.6.1 is appropriate given the behavioral changes. Ensure the EELS exception mapper compatibility is handled (either via regex updates or confirmed fixture expectations) before merging. Approve with minor verification requested on error message format compatibility. Automated review by Kimi (Moonshot AI) · kimi-k2.5 · custom prompt |
Lines of code reportTotal lines added: Detailed view |
🤖 Codex Code ReviewFindings
Aside from those two issues, the Automated review by OpenAI Codex · gpt-5.4 · custom prompt |
🤖 Claude Code ReviewHere is the review: PR Review:
|
|
Re: bot review concerns Error message regression: The EELS exception mapper was updated in a companion PR (ethereum/execution-specs, branch Pre-Amsterdam TX_MAX_GAS_LIMIT: EIP-7825 cap is enforced at tx validation time ( State gas on soft-fail CREATE: Matches spec. In EELS |
Benchmark Results ComparisonNo significant difference was registered for any benchmark run. Detailed ResultsBenchmark Results: BubbleSort
Benchmark Results: ERC20Approval
Benchmark Results: ERC20Mint
Benchmark Results: ERC20Transfer
Benchmark Results: Factorial
Benchmark Results: FactorialRecursive
Benchmark Results: Fibonacci
Benchmark Results: FibonacciRecursive
Benchmark Results: ManyHashes
Benchmark Results: MstoreBench
Benchmark Results: Push
Benchmark Results: SstoreBench_no_opt
|
6eb77c9 to
0cc888c
Compare
- Bump fixtures_bal.tar.gz from v5.5.1 to v5.6.1 across CI, Makefile, docs, and fixture URL files. - Move CREATE/CREATE2 is_static check before gas charging for Amsterdam+, matching the spec change in execution-specs#2608. - Move state gas charge (STATE_GAS_NEW_ACCOUNT) into generic_create() after MAX_INIT_CODE_SIZE validation, so oversized CREATE does not burn state gas for an account that was never created. - Fix per-tx gas check to use regular gas only (not max(regular, state)) per execution-specs#2583. State gas is validated at block end via max(block_regular, block_state) <= gas_limit. - Apply min(TX_MAX_GAS_LIMIT, tx.gas) cap in per-tx check per EIP-7825. - Update payload builder remaining_gas to track regular gas capacity for Amsterdam.
0cc888c to
4244837
Compare
🤖 Kimi Code ReviewHere is my review of the PR implementing EIP-8037 gas accounting changes for the Amsterdam fork. Critical Issues1. EELS Exception Mapper Compatibility (Potential Breaking Change)File: The error messages no longer contain // Before (required by mapper):
"Gas allowance exceeded: Block gas used overflow: ..."
// After (current):
"Gas allowance exceeded: ..."Recommendation: Either restore the substring or confirm the mapper at 2. Inconsistent Gas Cap ConstantsFiles: The code uses two different constants for the same 30M gas limit:
If these differ in value, this is a consensus-critical bug. If they're identical, consolidate them to prevent future drift. Logic & Safety3. CREATE Opcode Static Check OrderingFile: Moving the 4. State Gas Charging LocationFile: Moving 5. Gas Accounting LogicFile: The separation of regular gas (per-tx check) from state gas (block-end validation) correctly implements EIP-8037:
Automated review by Kimi (Moonshot AI) · kimi-k2.5 · custom prompt |
🤖 Codex Code ReviewFindings
I did not find another clear correctness or security issue in the touched LEVM validation paths from the diff alone. I did not run tests. Automated review by OpenAI Codex · gpt-5.4 · custom prompt |
🤖 Claude Code ReviewHere is the review: PR Review:
|
Greptile SummaryThis PR applies two EIP-8037 correctness fixes and bumps BAL fixtures from v5.5.1 to v5.6.1. The Confidence Score: 5/5Safe to merge — all remaining findings are P2 style suggestions with no correctness impact No P0 or P1 issues found. The one P2 finding is a naming inconsistency between POST_OSAKA_GAS_LIMIT_CAP and TX_MAX_GAS_LIMIT_AMSTERDAM that has no runtime impact since both constants equal 16,777,216. The logic fixes are correct and verified by 1103 passing BAL consume-engine tests per the PR description. No files require special attention; optional cleanup at crates/blockchain/payload.rs:612 to use TX_MAX_GAS_LIMIT_AMSTERDAM for naming consistency with the rest of this PR
|
| Filename | Overview |
|---|---|
| crates/vm/levm/src/opcode_handlers/system.rs | EIP-8037: is_static guard moved before stack pops for Amsterdam+; state gas charged after initcode size validation to avoid burning state gas for rejected CREATEs |
| crates/vm/backends/levm/mod.rs | Per-tx gas check fixed to use block_regular_gas_used and min(TX_MAX_GAS_LIMIT_AMSTERDAM, tx.gas) cap across all three execute_block paths per EIP-8037/EIP-7825 |
| crates/blockchain/payload.rs | remaining_gas now tracks regular gas only for Amsterdam; tx gas reservation cap uses POST_OSAKA_GAS_LIMIT_CAP (correct value, but inconsistent name vs TX_MAX_GAS_LIMIT_AMSTERDAM used elsewhere in this PR) |
| .github/workflows/daily_hive_report.yaml | BAL fixtures URL bumped from v5.5.1 to v5.6.1 |
| .github/workflows/pr-main_l1.yaml | BAL fixtures URL bumped from v5.5.1 to v5.6.1 |
| Makefile | AMSTERDAM_FIXTURES_URL default bumped from v5.5.1 to v5.6.1 |
| docs/developers/l1/testing/hive.md | Documentation updated to reflect v5.6.1 BAL fixtures URL |
| tooling/ef_tests/blockchain/.fixtures_url_amsterdam | BAL fixture URL bumped from v5.5.1 to v5.6.1 |
| tooling/ef_tests/state/.fixtures_url_amsterdam | BAL fixture URL bumped from v5.5.1 to v5.6.1 |
Sequence Diagram
sequenceDiagram
participant EVM as EVM dispatch
participant H as OpCreate(2)Handler
participant GC as generic_create()
EVM->>H: eval(vm)
Note over H: Amsterdam+: is_static guard BEFORE stack pops (NEW)
H-->>EVM: OpcodeNotAllowedInStaticContext (if static)
H->>H: stack.pop() [value, offset, len (+salt)]
H->>H: increase_consumed_gas(create_cost)
H->>GC: generic_create(value, offset, len, salt)
Note over GC: Check code_size <= MAX_INIT_CODE_SIZE
GC-->>H: OutOfGas if oversized — no state gas charged (FIXED)
Note over GC: Amsterdam+: increase_state_gas(STATE_GAS_NEW_ACCOUNT) AFTER size check (MOVED)
GC->>GC: Pre-Amsterdam is_static guard (fork < Amsterdam)
GC->>GC: Reserve subcall gas, load initcode, deploy
GC-->>H: OpcodeResult
Prompt To Fix All With AI
This is a comment left during a code review.
Path: crates/blockchain/payload.rs
Line: 611-615
Comment:
**Inconsistent constant for Amsterdam gas cap**
The inline comment says "cap at `TX_MAX_GAS_LIMIT`" but the code uses `POST_OSAKA_GAS_LIMIT_CAP`. Every other Amsterdam-gated site in this PR (`levm/mod.rs` lines 137 and 435) uses `TX_MAX_GAS_LIMIT_AMSTERDAM`. Both constants equal 16,777,216 (`1 << 24`), so there is no runtime impact, but using the Osaka-named constant in an Amsterdam-gated branch forces readers to look up the definition to confirm equivalence.
```suggestion
let tx_gas_reservation = if context.is_amsterdam {
head_tx.tx.gas_limit().min(TX_MAX_GAS_LIMIT_AMSTERDAM)
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(l1): bump BAL fixtures to v5.6.1 and..." | Re-trigger Greptile
| let tx_gas_reservation = if context.is_amsterdam { | ||
| head_tx.tx.gas_limit().min(POST_OSAKA_GAS_LIMIT_CAP) | ||
| } else { | ||
| head_tx.tx.gas_limit() | ||
| }; |
There was a problem hiding this comment.
Inconsistent constant for Amsterdam gas cap
The inline comment says "cap at TX_MAX_GAS_LIMIT" but the code uses POST_OSAKA_GAS_LIMIT_CAP. Every other Amsterdam-gated site in this PR (levm/mod.rs lines 137 and 435) uses TX_MAX_GAS_LIMIT_AMSTERDAM. Both constants equal 16,777,216 (1 << 24), so there is no runtime impact, but using the Osaka-named constant in an Amsterdam-gated branch forces readers to look up the definition to confirm equivalence.
| let tx_gas_reservation = if context.is_amsterdam { | |
| head_tx.tx.gas_limit().min(POST_OSAKA_GAS_LIMIT_CAP) | |
| } else { | |
| head_tx.tx.gas_limit() | |
| }; | |
| let tx_gas_reservation = if context.is_amsterdam { | |
| head_tx.tx.gas_limit().min(TX_MAX_GAS_LIMIT_AMSTERDAM) |
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/blockchain/payload.rs
Line: 611-615
Comment:
**Inconsistent constant for Amsterdam gas cap**
The inline comment says "cap at `TX_MAX_GAS_LIMIT`" but the code uses `POST_OSAKA_GAS_LIMIT_CAP`. Every other Amsterdam-gated site in this PR (`levm/mod.rs` lines 137 and 435) uses `TX_MAX_GAS_LIMIT_AMSTERDAM`. Both constants equal 16,777,216 (`1 << 24`), so there is no runtime impact, but using the Osaka-named constant in an Amsterdam-gated branch forces readers to look up the definition to confirm equivalence.
```suggestion
let tx_gas_reservation = if context.is_amsterdam {
head_tx.tx.gas_limit().min(TX_MAX_GAS_LIMIT_AMSTERDAM)
```
How can I resolve this? If you propose a fix, please make it concise.
ElFantasma
left a comment
There was a problem hiding this comment.
Just same comment as greptile
Bump BAL fixtures from v5.5.1 to v5.6.1 across Makefile, CI workflows, docs, and fixture URL files.
Fix two EIP-8037 correctness issues in
system.rs: move theis_staticcheck to CREATE/CREATE2 handlers (Amsterdam+ only) before stack pops and gas charging, matching ethereum/execution-specs#2608; moveincrease_state_gas(STATE_GAS_NEW_ACCOUNT)intogeneric_create()afterMAX_INIT_CODE_SIZEvalidation so oversized CREATE doesn't burn state gas for an account never created.Fix per-tx gas check in
levm/mod.rsto useblock_regular_gas_usedinstead ofmax(regular, state)per ethereum/execution-specs#2583, and applymin(TX_MAX_GAS_LIMIT, tx.gas)cap per EIP-7825. Applied acrossexecute_block,execute_block_pipeline, andexecute_block_parallel.Update
payload.rsto trackremaining_gasusing regular gas capacity only for Amsterdam. All 1103 BAL consume-engine tests pass.Along with ethereum/execution-specs#2632