Skip to content

feat(l1): bal-devnet-3 alignment#6271

Merged
edg-l merged 12 commits intobal-devnet-3from
bump-amsterdam-bal-devnet-3
Mar 3, 2026
Merged

feat(l1): bal-devnet-3 alignment#6271
edg-l merged 12 commits intobal-devnet-3from
bump-amsterdam-bal-devnet-3

Conversation

@edg-l
Copy link
Contributor

@edg-l edg-l commented Feb 27, 2026

Motivation

bal-devnet-3 alignment: bump fixtures, implement EIP-8037 state creation gas cost increase, and fix EIP-8024 encoding.

Changes

Infrastructure

  • Bump Amsterdam fixtures branch from devnets/bal/2 to devnets/bal/3
  • Bump Amsterdam ef_tests fixtures to bal@v5.2.0

EIP-8024: Branchless normalization

  • Updated encoding to branchless normalization per latest spec

EIP-8037: State Creation Gas Cost Increase (spec)

  • Initial reservoir model implementation (state gas reservoir from excess gas_limit)
  • Two-dimensional block gas accounting: block.gas_used = max(sum(regular), sum(state)) per EIP-7778
  • Receipt cumulative_gas_used = post-refund total (what user pays)
  • Reservoir subtraction from gas_used in finalize_execution
  • EIP-7702 auth refund to reservoir for Amsterdam+
  • Skip Osaka TX_MAX_GAS_LIMIT cap for Amsterdam (reservoir model replaces per-tx limit)
  • CREATE state gas charged before early-failure checks (balance/depth/nonce)
  • SSTORE state gas refund via normal refund counter (subject to 1/5 cap per EIP-3529)
  • increase_state_gas reordered: charge first, mutate counters only on success (matches EELS)
  • Track orphaned state gas spill in reverted children (reverted_child_state_spill counter)
  • CREATE account state gas survives initcode revert (snapshot taken after charge)
  • CREATE collision gas excluded from regular dimension (EELS escrow mechanism)
  • Amsterdam intrinsic regular gas cap validation (max(intrinsic_regular, calldata_floor) > TX_MAX_GAS_LIMIT)

Test results

EIP-8037: 114/114 bal@v5.2.0 fixture tests passing via engine_newPayloadV5

Checklist

  • Updated STORE_SCHEMA_VERSION (crates/storage/lib.rs) if the PR includes breaking changes to the Store requiring a re-sync.

@edg-l edg-l requested a review from a team as a code owner February 27, 2026 11:31
@edg-l edg-l marked this pull request as draft February 27, 2026 11:31
@github-actions github-actions bot added the L1 Ethereum client label Feb 27, 2026
@github-actions
Copy link

🤖 Kimi Code Review

Review Summary

This PR updates the Amsterdam test fixtures branch from devnets/bal/2 to devnets/bal/3 across CI configuration, Makefile, and documentation. The changes are straightforward and appear correct.

Issues Found

None - the changes are consistent across all files and the update appears intentional.

Verification

The changes are:

  1. Consistent - All three files updated with the same branch name
  2. Appropriate - Updating to a newer test branch (bal/3 vs bal/2) is a reasonable progression
  3. Well-documented - The documentation changes maintain accuracy

Suggestion

Consider adding a comment in the CI workflow file (.github/workflows/daily_hive_report.yaml) near line 125-126 explaining why bal/3 is used instead of bal/2, similar to how the documentation explains the fixture choices. This would help future maintainers understand the rationale for the branch selection.


Automated review by Kimi (Moonshot AI) · custom prompt

@ethrex-project-sync ethrex-project-sync bot moved this to In Progress in ethrex_l1 Feb 27, 2026
@github-actions
Copy link

🤖 Claude Code Review

This is a simple maintenance PR bumping the Amsterdam EIP-7928 BAL fixtures branch reference from devnets/bal/2 to devnets/bal/3.


Review

Summary: Straightforward version bump — all five occurrences of devnets/bal/2 have been updated to devnets/bal/3 consistently across the three affected files. A grep confirms no stale references remain in the repo.

Consistency check:

  • Makefile:152AMSTERDAM_FIXTURES_BRANCH default value updated.
  • .github/workflows/daily_hive_report.yaml:126 — CI flag updated.
  • docs/developers/l1/testing/hive.md:293,316,334 — All three doc occurrences (inline example, note, and update guide) updated correctly.

Observation: The fixtures URL (bal@v5.1.0/fixtures_bal.tar.gz) is unchanged in both the CI workflow and Makefile. This appears intentional — the branch ref on the EELS execution spec tests side advances while the fixtures tarball version stays at v5.1.0. Worth confirming that devnets/bal/3 is indeed compatible with the bal@v5.1.0 fixture set, but this is likely a known-good pairing from the upstream devnet.

No bugs, no security concerns, no logic issues. The change is correct and complete.


Automated review by Claude (Anthropic) · custom prompt

@github-actions
Copy link

🤖 Codex Code Review

No blocking findings.

  1. Non-blocking: CI reproducibility risk from tracking a mutable branch

Given scope, there are no direct code correctness, consensus, gas-accounting, memory-safety, or Rust-idiom concerns in this PR.


Automated review by OpenAI Codex · custom prompt

@greptile-apps
Copy link

greptile-apps bot commented Feb 27, 2026

Greptile Summary

This PR updates all Amsterdam fixtures branch references from devnets/bal/2 to devnets/bal/3 across the codebase.

  • Updated AMSTERDAM_FIXTURES_BRANCH variable in Makefile
  • Updated CI workflow flags for Amsterdam hive tests
  • Updated documentation examples and notes to reflect the new branch

All changes are consistent and correctly synchronized across configuration, CI, and documentation files.

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • Simple version bump with consistent string replacements across all files, no logic changes or potential side effects
  • No files require special attention

Important Files Changed

Filename Overview
Makefile Updated AMSTERDAM_FIXTURES_BRANCH from devnets/bal/2 to devnets/bal/3
.github/workflows/daily_hive_report.yaml Updated Amsterdam fixtures branch argument from devnets/bal/2 to devnets/bal/3
docs/developers/l1/testing/hive.md Updated documentation examples and notes from devnets/bal/2 to devnets/bal/3

Last reviewed commit: 0cbb3c6

@edg-l edg-l force-pushed the bump-amsterdam-bal-devnet-3 branch from 0cbb3c6 to 27d2542 Compare March 2, 2026 07:37
@edg-l edg-l changed the base branch from main to bal-devnet-3 March 2, 2026 07:40
@edg-l edg-l force-pushed the bump-amsterdam-bal-devnet-3 branch from fd2b5d6 to cd22ef3 Compare March 2, 2026 07:40
@github-actions
Copy link

github-actions bot commented Mar 2, 2026

Lines of code report

Total lines added: 148
Total lines removed: 4
Total lines changed: 152

Detailed view
+------------------------------------------------------------------------+-------+------+
| File                                                                   | Lines | Diff |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/common/validation.rs                                     | 215   | +2   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/backends/levm/mod.rs                                  | 851   | +2   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/call_frame.rs                                | 355   | +4   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/constants.rs                                 | 67    | +1   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/execution_handlers.rs                        | 162   | -4   |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/hooks/default_hook.rs                        | 451   | +41  |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/hooks/l2_hook.rs                             | 605   | +11  |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcode_handlers/stack_memory_storage_flow.rs | 290   | +14  |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/opcode_handlers/system.rs                    | 1056  | +31  |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/utils.rs                                     | 542   | +28  |
+------------------------------------------------------------------------+-------+------+
| ethrex/crates/vm/levm/src/vm.rs                                        | 617   | +14  |
+------------------------------------------------------------------------+-------+------+

@github-actions
Copy link

github-actions bot commented Mar 2, 2026

Benchmark Results Comparison

No significant difference was registered for any benchmark run.

Detailed Results

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
main_revm_BubbleSort 2.997 ± 0.018 2.969 3.028 1.09 ± 0.01
main_levm_BubbleSort 2.747 ± 0.027 2.719 2.799 1.00 ± 0.01
pr_revm_BubbleSort 2.961 ± 0.013 2.940 2.984 1.08 ± 0.01
pr_levm_BubbleSort 2.747 ± 0.019 2.716 2.776 1.00

Benchmark Results: ERC20Approval

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Approval 989.9 ± 42.6 967.0 1106.6 1.00
main_levm_ERC20Approval 1040.5 ± 18.7 1021.9 1075.2 1.05 ± 0.05
pr_revm_ERC20Approval 1002.1 ± 39.4 981.6 1112.8 1.01 ± 0.06
pr_levm_ERC20Approval 1031.9 ± 7.2 1022.0 1041.9 1.04 ± 0.05

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 134.2 ± 1.5 131.7 136.5 1.00
main_levm_ERC20Mint 155.5 ± 1.3 154.1 158.1 1.16 ± 0.02
pr_revm_ERC20Mint 134.4 ± 5.8 130.5 150.2 1.00 ± 0.04
pr_levm_ERC20Mint 157.5 ± 1.7 156.0 160.7 1.17 ± 0.02

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 231.2 ± 1.3 230.0 234.0 1.00 ± 0.01
main_levm_ERC20Transfer 268.1 ± 2.3 266.0 273.5 1.16 ± 0.01
pr_revm_ERC20Transfer 230.3 ± 2.0 227.7 234.6 1.00
pr_levm_ERC20Transfer 268.1 ± 2.2 262.6 270.4 1.16 ± 0.01

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 229.6 ± 1.7 227.7 233.1 1.00 ± 0.01
main_levm_Factorial 233.9 ± 1.0 231.5 235.1 1.02 ± 0.01
pr_revm_Factorial 229.0 ± 1.3 225.5 230.0 1.00
pr_levm_Factorial 236.7 ± 6.5 232.1 254.1 1.03 ± 0.03

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.678 ± 0.058 1.551 1.756 1.00
main_levm_FactorialRecursive 10.320 ± 0.038 10.231 10.359 6.15 ± 0.21
pr_revm_FactorialRecursive 1.689 ± 0.078 1.521 1.758 1.01 ± 0.06
pr_levm_FactorialRecursive 10.307 ± 0.029 10.263 10.355 6.14 ± 0.21

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 210.6 ± 5.0 206.3 223.6 1.00 ± 0.02
main_levm_Fibonacci 211.4 ± 2.4 208.6 215.2 1.01 ± 0.01
pr_revm_Fibonacci 209.7 ± 0.6 209.1 210.7 1.00
pr_levm_Fibonacci 212.6 ± 3.9 209.1 222.3 1.01 ± 0.02

Benchmark Results: FibonacciRecursive

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_FibonacciRecursive 855.3 ± 9.8 838.3 872.8 1.24 ± 0.03
main_levm_FibonacciRecursive 706.4 ± 11.3 693.3 726.4 1.02 ± 0.03
pr_revm_FibonacciRecursive 852.0 ± 13.0 836.3 868.7 1.23 ± 0.03
pr_levm_FibonacciRecursive 691.6 ± 13.0 677.7 722.8 1.00

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 8.4 ± 0.1 8.3 8.5 1.00
main_levm_ManyHashes 9.7 ± 0.2 9.5 10.1 1.16 ± 0.03
pr_revm_ManyHashes 8.5 ± 0.1 8.4 8.7 1.01 ± 0.01
pr_levm_ManyHashes 9.7 ± 0.1 9.6 9.9 1.16 ± 0.02

Benchmark Results: MstoreBench

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_MstoreBench 264.1 ± 3.7 260.6 274.0 1.29 ± 0.02
main_levm_MstoreBench 204.6 ± 1.2 202.9 206.9 1.00
pr_revm_MstoreBench 263.5 ± 5.0 260.9 277.4 1.29 ± 0.03
pr_levm_MstoreBench 206.0 ± 1.8 203.5 209.8 1.01 ± 0.01

Benchmark Results: Push

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Push 297.0 ± 1.3 293.6 298.1 1.14 ± 0.01
main_levm_Push 265.5 ± 9.6 258.4 283.8 1.02 ± 0.04
pr_revm_Push 296.4 ± 1.6 293.3 299.0 1.14 ± 0.01
pr_levm_Push 260.7 ± 0.8 259.6 262.4 1.00

Benchmark Results: SstoreBench_no_opt

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_SstoreBench_no_opt 169.0 ± 5.4 163.9 181.4 1.61 ± 0.05
main_levm_SstoreBench_no_opt 105.5 ± 3.0 104.3 114.1 1.01 ± 0.03
pr_revm_SstoreBench_no_opt 172.0 ± 6.8 164.1 188.7 1.64 ± 0.07
pr_levm_SstoreBench_no_opt 104.7 ± 0.5 104.1 105.8 1.00

edg-l added 7 commits March 2, 2026 11:48
Align DUPN, SWAPN, and EXCHANGE decoding with the updated EIP-8024 spec
(ethereum/EIPs#11306). decode_single now uses (x + 145) % 256 instead of
branching, and decode_pair uses XOR 0x8F instead of conditional subtraction.
EXCHANGE valid range extended from 0x00-0x4F to 0x00-0x51, adding two new
swappable pairs (14,15) and (14,16).
- Subtract remaining state_gas_reservoir from gas_used in
  finalize_execution (unused reservoir is returned, not consumed)
- EIP-7702 auth refund returns to state gas reservoir for Amsterdam+
  instead of regular refund counter
- Skip Osaka TX_MAX_GAS_LIMIT cap for Amsterdam+ (EIP-8037 reservoir
  model removes the per-tx gas limit restriction)
EIP-8037 state gas for new account creation must be consumed even
if CREATE fails due to insufficient balance, depth limit, or max
nonce. Only initcode revert refunds the state gas via the snapshot
mechanism.
…tion

When an SSTORE restores a slot to zero (0→x→0), the state gas refund
must go through the normal refund counter (subject to the 1/5 cap),
not directly reduce state_gas_used. The state_gas_used must reflect
peak consumption for block-level max(regular, state) accounting per
EIP-7778/EIP-8037.
Three related fixes for state gas accounting in Amsterdam fork:

1. increase_state_gas must not mutate on OOG: Reorder to charge gas
   first, then decrement reservoir, then increment state_gas_used.
   On OOG the early return leaves all counters unmodified (matches EELS).

2. Track orphaned state gas spill in reverted children: When child
   frames consume spilled state gas then revert, state_gas_used is
   restored but the spill remains in gas_used. Track this via
   reverted_child_state_spill counter and exclude from regular gas
   derivation in refund_sender.

3. CREATE account state gas survives initcode revert: Move
   state_gas_used/reservoir snapshots to AFTER the account state gas
   charge. Per EELS, CREATE's account charge is in the parent frame
   and persists even when initcode reverts.
Two fixes for Amsterdam EIP-8037 state gas accounting:

1. CREATE collision gas excluded from regular dimension: On CREATE2
   address collision, reserved child gas is consumed but per EELS
   escrow mechanism it should not count as regular gas. Add the
   consumed gas_limit to the exclusion counter so derived regular
   gas is not inflated.

2. Amsterdam intrinsic regular gas cap validation: Add missing EELS
   check that rejects TXs where max(intrinsic_regular, calldata_floor)
   exceeds TX_MAX_GAS_LIMIT. Regular gas is capped at TX_MAX_GAS_LIMIT
   in Amsterdam (excess becomes state gas reservoir), so intrinsic
   regular cost must fit within the cap.
@edg-l edg-l changed the title chore(l1): bump Amsterdam fixtures branch to devnets/bal/3 feat(l1): bal-devnet-3 alignment Mar 2, 2026
edg-l added 2 commits March 2, 2026 16:58
execution-spec-tests reorganized fixtures into per-fork subdirectories
(e.g., fixtures/state_tests/for_amsterdam/ instead of
fixtures/state_tests/amsterdam/).
Matches EELS where charge_state_gas() is called in create()/create2()
before generic_create() computes the child gas limit. Previously the
state gas was charged inside generic_create() after the 63/64
reservation, leaving the parent with ~2,796 gas remaining; when the
reservoir is 0 (gas_limit < TX_MAX_GAS_LIMIT) the 131,488-gas spill
would OOG. Moving the charge to op_create/op_create2 ensures child gas
is 63/64 of the gas remaining after state gas is accounted for.

Fixes test_selfdestruct_to_self_same_tx (all 4 variants).
@edg-l edg-l merged commit b273864 into bal-devnet-3 Mar 3, 2026
40 of 50 checks passed
@edg-l edg-l deleted the bump-amsterdam-bal-devnet-3 branch March 3, 2026 08:44
@github-project-automation github-project-automation bot moved this from In Progress to Done in ethrex_l1 Mar 3, 2026
edg-l added a commit that referenced this pull request Mar 4, 2026
- EIP-8037 implemented (#6271 merged, #6293 open with all tests passing)
- BAL optimizations shipped: parallel execution (#6233), batched reads + parallel state root (#6227)
- EF tests and all hive suites passing (including Amsterdam consume tests)
- Updated devnet-3 changes: BAL size cap, 7708 rename, 8024 branchless normalization
@edg-l edg-l mentioned this pull request Mar 4, 2026
1 task
github-merge-queue bot pushed a commit that referenced this pull request Mar 10, 2026
## Summary
- Updated forks-roadmap.md with current bal-devnet-3 status
- EIP-8037 State Creation Gas Cost implemented (#6271 merged, #6293 open
— EF tests + all hive suites passing)
- BAL optimizations shipped: parallel execution (#6233), batched reads +
parallel state root (#6227)
- Devnet-3 spec changes: BAL size cap, EIP-7708 Burn rename, EIP-8024
branchless normalization
- Updated tables, priority note, and technical debt section to reflect
current state

[Rendered
markdown](https://github.com/lambdaclass/ethrex/blob/docs/update-forks-roadmap-march-4/docs/roadmaps/forks-roadmap.md)

## Test plan
- [ ] Verify markdown renders correctly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L1 Ethereum client

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant