chore(l1): fix precompile tests from EIP-7702#2711
Closed
DiegoCivi wants to merge 3 commits into
Closed
Conversation
When doing a generic call (CALL, CALLCODE, DELEGATECALL, STATICCALL) we were first checking if it was a delegation and if the bytecode was empty, and if this was true the call would not continue. After that the transfer of WEI to the account was done. When using precompiles (which have empty code) we never reached the transfering stage, so the change in the balance was never done and the state root was not correct. We now first do the transfer and the the checking of bytecode. This fixes 17 tests that were being skipped on LEVM.
Benchmark Results ComparisonPR ResultsBenchmark Results: Factorial
Benchmark Results: Factorial - Recursive
Benchmark Results: Fibonacci
Benchmark Results: ManyHashes
Benchmark Results: BubbleSort
Benchmark Results: ERC20 - Transfer
Benchmark Results: ERC20 - Mint
Benchmark Results: ERC20 - Approval
Main ResultsBenchmark Results: Factorial
Benchmark Results: Factorial - Recursive
Benchmark Results: Fibonacci
Benchmark Results: ManyHashes
Benchmark Results: BubbleSort
Benchmark Results: ERC20 - Transfer
Benchmark Results: ERC20 - Mint
Benchmark Results: ERC20 - Approval
|
When a precompile is the target of the delegation in a 0x04 type transaction, its execution should return always success. This is a possible solution that changes the result of an ExecutionReport from a Revert to a Success if we are in this specific case.
Lines of code reportTotal lines added: Detailed view |
JereSalo
reviewed
May 12, 2025
Comment on lines
828
to
834
| // Transfer value from caller to callee. | ||
| if should_transfer_value { | ||
| self.decrease_account_balance(msg_sender, value)?; | ||
| self.increase_account_balance(to, value)?; | ||
| } | ||
|
|
||
| let new_depth = { |
Contributor
There was a problem hiding this comment.
let current_call_frame = self.current_call_frame_mut()?;
let new_depth = current_call_frame
.depth
.checked_add(1)
.ok_or(InternalError::ArithmeticOperationOverflow)?;
if new_depth > 1024 {
current_call_frame.gas_used = current_call_frame
.gas_used
.checked_sub(gas_limit)
.ok_or(InternalError::GasOverflow)?;
current_call_frame.stack.push(REVERT_FOR_CALL)?;
return Ok(OpcodeResult::Continue { pc_increment: 1 });
}
// Transfer value from caller to callee.
if should_transfer_value {
self.decrease_account_balance(msg_sender, value)?;
self.increase_account_balance(to, value)?;
}
if bytecode.is_empty() && is_delegation {
let current_call_frame = self.current_call_frame_mut()?;
current_call_frame.gas_used = current_call_frame
.gas_used
.checked_sub(gas_limit)
.ok_or(InternalError::GasOverflow)?;
current_call_frame.stack.push(SUCCESS_FOR_CALL)?;
return Ok(OpcodeResult::Continue { pc_increment: 1 });
}
What do you think about leaving it this way? Maybe we could also add a comment above the check of empty bytecode and delegation explaining what that means and why we return success.
Contributor
Author
There was a problem hiding this comment.
I agree, it looks better that way. However I did some little changes because of problems with the borrow checker, let me know if you agree with them. 36c7a
Contributor
Author
|
This was done in #2842 |
edg-l
added a commit
that referenced
this pull request
Apr 23, 2026
…nting The zkevm@v0.3.x fixtures under eip8025_optional_proofs/ were filled against bal@v5.6.1 (devnets/bal/3), which predates EELS PR #2711 "immutable intrinsic_state_gas for EIP-7702". Their expected gas assumes the auth refund still deducts from block-accounted state gas. Our devnet-4 (bal@v5.7.0) implementation correctly keeps intrinsic_state_gas immutable and routes the refund to the reservoir only (commit a5671c9), so these six fixtures report GasUsedMismatch/ReceiptsRootMismatch by construction. Skip until an upstream zkevm@v0.4.x release ships fixtures regenerated against devnet-4. Remaining failures after this: 0 on `make -C tooling/ef_tests/blockchain test`.
edg-l
added a commit
that referenced
this pull request
Apr 23, 2026
Brings ethrex up to bal-devnet-4 fixture spec. Rolls up EIP-7928, EIP-8037, EIP-7976, EIP-7981, EIP-7708 and misc BAL validation fixes into one change set. BAL (EIP-7928) - Widen BlockAccessIndex and related recorder/index fields to u32. - Shadow BAL recorder on per-tx tx_dbs in the parallel validator: diff touched_addresses / storage_reads against header BAL to catch missing pure-access entries and missing storage_reads. - Fall back to pre-state code_hash in validate_tx_execution PART B when the BAL has no code_changes entry (missing_code_change). - Stop whitelisting SYSTEM_ADDRESS from unaccessed_pure_accounts via system_seed / current_accounts_state scrubs; user-tx touches still remove it via the per-tx tracked_accounts path. EIP-8037 (state gas 2D accounting) - Dynamic cost_per_state_byte(block_gas_limit), Amsterdam only. - Two-counter reservoir: state_gas_spill_outstanding + state_gas_credit_against_drain for correct revert math across nested sub-calls (PR #2733 clamp-and-spill). - Per-tx 2D inclusion check (PR #2703) in sequential + parallel paths: reject with GAS_ALLOWANCE_EXCEEDED when tx.gas worst-case exceeds remaining block regular/state budget. - intrinsic_state_gas immutable across the tx (PR #2711) and subtracted separately when deriving block-dimensional regular gas. - CREATE collision/early/child failure refunds account state gas. - Same-tx SELFDESTRUCT refunds state gas clamped against execution-only state gas (PR #2707), not total state_gas_used. - Revert-path reservoir refill uses the PR #2733 X - Z formula. - Top-level reservoir reset on tx failure (PR #2689). - Zero gas_remaining on precompile exceptional halt so block accounting sees the full intrinsic. Calldata / access-list floors - TOTAL_COST_FLOOR_PER_TOKEN 10 -> 16 under Amsterdam (EIP-7976). - Access-list data bytes fold into floor-token count (EIP-7981). EIP-7708 - Lex-ordered burn logs, no coinbase priority-fee log, SELFDESTRUCT- destination coalescing. Tests - New levm tests for EIP-7976/7981, EIP-8037 refund/code-deposit/ top-level-failure paths. - Skip 6 zkevm@v0.3.0 EIP-8025 fixtures filled against bal@v5.6.1 (re-enable once zkevm@v0.4.x ships). Hive consume-engine amsterdam: 1339 pass, 3 remaining (withdrawal missing-entry cases addressed by PR #6463, cherry-pick pending).
edg-l
added a commit
that referenced
this pull request
Apr 23, 2026
Brings ethrex up to bal-devnet-4 fixture spec. Rolls up EIP-7928, EIP-8037, EIP-7976, EIP-7981, EIP-7708 and misc BAL validation fixes into one change set. BAL (EIP-7928) - Widen BlockAccessIndex and related recorder/index fields to u32. - Shadow BAL recorder on per-tx tx_dbs in the parallel validator: diff touched_addresses / storage_reads against header BAL to catch missing pure-access entries and missing storage_reads. - Fall back to pre-state code_hash in validate_tx_execution PART B when the BAL has no code_changes entry (missing_code_change). - Stop whitelisting SYSTEM_ADDRESS from unaccessed_pure_accounts via system_seed / current_accounts_state scrubs; user-tx touches still remove it via the per-tx tracked_accounts path. EIP-8037 (state gas 2D accounting) - Dynamic cost_per_state_byte(block_gas_limit), Amsterdam only. - Two-counter reservoir: state_gas_spill_outstanding + state_gas_credit_against_drain for correct revert math across nested sub-calls (PR #2733 clamp-and-spill). - Per-tx 2D inclusion check (PR #2703) in sequential + parallel paths: reject with GAS_ALLOWANCE_EXCEEDED when tx.gas worst-case exceeds remaining block regular/state budget. - intrinsic_state_gas immutable across the tx (PR #2711) and subtracted separately when deriving block-dimensional regular gas. - CREATE collision/early/child failure refunds account state gas. - Same-tx SELFDESTRUCT refunds state gas clamped against execution-only state gas (PR #2707), not total state_gas_used. - Revert-path reservoir refill uses the PR #2733 X - Z formula. - Top-level reservoir reset on tx failure (PR #2689). - Zero gas_remaining on precompile exceptional halt so block accounting sees the full intrinsic. Calldata / access-list floors - TOTAL_COST_FLOOR_PER_TOKEN 10 -> 16 under Amsterdam (EIP-7976). - Access-list data bytes fold into floor-token count (EIP-7981). EIP-7708 - Lex-ordered burn logs, no coinbase priority-fee log, SELFDESTRUCT- destination coalescing. Tests - New levm tests for EIP-7976/7981, EIP-8037 refund/code-deposit/ top-level-failure paths. - Skip 6 zkevm@v0.3.0 EIP-8025 fixtures filled against bal@v5.6.1 (re-enable once zkevm@v0.4.x ships). Hive consume-engine amsterdam: 1339 pass, 3 remaining (withdrawal missing-entry cases addressed by PR #6463, cherry-pick pending).
edg-l
added a commit
that referenced
this pull request
Apr 23, 2026
Brings ethrex up to bal-devnet-4 fixture spec. Rolls up EIP-7928, EIP-8037, EIP-7976, EIP-7981, EIP-7708 and misc BAL validation fixes into one change set. BAL (EIP-7928) - Widen BlockAccessIndex and related recorder/index fields to u32. - Shadow BAL recorder on per-tx tx_dbs in the parallel validator: diff touched_addresses / storage_reads against header BAL to catch missing pure-access entries and missing storage_reads. - Fall back to pre-state code_hash in validate_tx_execution PART B when the BAL has no code_changes entry (missing_code_change). - Stop whitelisting SYSTEM_ADDRESS from unaccessed_pure_accounts via system_seed / current_accounts_state scrubs; user-tx touches still remove it via the per-tx tracked_accounts path. EIP-8037 (state gas 2D accounting) - Dynamic cost_per_state_byte(block_gas_limit), Amsterdam only. - Two-counter reservoir: state_gas_spill_outstanding + state_gas_credit_against_drain for correct revert math across nested sub-calls (PR #2733 clamp-and-spill). - Per-tx 2D inclusion check (PR #2703) in sequential + parallel paths: reject with GAS_ALLOWANCE_EXCEEDED when tx.gas worst-case exceeds remaining block regular/state budget. - intrinsic_state_gas immutable across the tx (PR #2711) and subtracted separately when deriving block-dimensional regular gas. - CREATE collision/early/child failure refunds account state gas. - Same-tx SELFDESTRUCT refunds state gas clamped against execution-only state gas (PR #2707), not total state_gas_used. - Revert-path reservoir refill uses the PR #2733 X - Z formula. - Top-level reservoir reset on tx failure (PR #2689). - Zero gas_remaining on precompile exceptional halt so block accounting sees the full intrinsic. Calldata / access-list floors - TOTAL_COST_FLOOR_PER_TOKEN 10 -> 16 under Amsterdam (EIP-7976). - Access-list data bytes fold into floor-token count (EIP-7981). EIP-7708 - Lex-ordered burn logs, no coinbase priority-fee log, SELFDESTRUCT- destination coalescing. Tests - New levm tests for EIP-7976/7981, EIP-8037 refund/code-deposit/ top-level-failure paths. - Skip 6 zkevm@v0.3.0 EIP-8025 fixtures filled against bal@v5.6.1 (re-enable once zkevm@v0.4.x ships). Hive consume-engine amsterdam: 1339 pass, 3 remaining (withdrawal missing-entry cases addressed by PR #6463, cherry-pick pending).
This was referenced Apr 23, 2026
edg-l
added a commit
that referenced
this pull request
May 6, 2026
Brings ethrex up to bal-devnet-4 fixture spec. Rolls up EIP-7928, EIP-8037, EIP-7976, EIP-7981, EIP-7708 and misc BAL validation fixes into one change set. BAL (EIP-7928) - Widen BlockAccessIndex and related recorder/index fields to u32. - Shadow BAL recorder on per-tx tx_dbs in the parallel validator: diff touched_addresses / storage_reads against header BAL to catch missing pure-access entries and missing storage_reads. - Fall back to pre-state code_hash in validate_tx_execution PART B when the BAL has no code_changes entry (missing_code_change). - Stop whitelisting SYSTEM_ADDRESS from unaccessed_pure_accounts via system_seed / current_accounts_state scrubs; user-tx touches still remove it via the per-tx tracked_accounts path. EIP-8037 (state gas 2D accounting) - Dynamic cost_per_state_byte(block_gas_limit), Amsterdam only. - Two-counter reservoir: state_gas_spill_outstanding + state_gas_credit_against_drain for correct revert math across nested sub-calls (PR #2733 clamp-and-spill). - Per-tx 2D inclusion check (PR #2703) in sequential + parallel paths: reject with GAS_ALLOWANCE_EXCEEDED when tx.gas worst-case exceeds remaining block regular/state budget. - intrinsic_state_gas immutable across the tx (PR #2711) and subtracted separately when deriving block-dimensional regular gas. - CREATE collision/early/child failure refunds account state gas. - Same-tx SELFDESTRUCT refunds state gas clamped against execution-only state gas (PR #2707), not total state_gas_used. - Revert-path reservoir refill uses the PR #2733 X - Z formula. - Top-level reservoir reset on tx failure (PR #2689). - Zero gas_remaining on precompile exceptional halt so block accounting sees the full intrinsic. Calldata / access-list floors - TOTAL_COST_FLOOR_PER_TOKEN 10 -> 16 under Amsterdam (EIP-7976). - Access-list data bytes fold into floor-token count (EIP-7981). EIP-7708 - Lex-ordered burn logs, no coinbase priority-fee log, SELFDESTRUCT- destination coalescing. Tests - New levm tests for EIP-7976/7981, EIP-8037 refund/code-deposit/ top-level-failure paths. - Skip 6 zkevm@v0.3.0 EIP-8025 fixtures filled against bal@v5.6.1 (re-enable once zkevm@v0.4.x ships). Hive consume-engine amsterdam: 1339 pass, 3 remaining (withdrawal missing-entry cases addressed by PR #6463, cherry-pick pending).
edg-l
added a commit
that referenced
this pull request
May 6, 2026
Brings ethrex up to bal-devnet-4 fixture spec. Rolls up EIP-7928, EIP-8037, EIP-7976, EIP-7981, EIP-7708 and misc BAL validation fixes into one change set. BAL (EIP-7928) - Widen BlockAccessIndex and related recorder/index fields to u32. - Shadow BAL recorder on per-tx tx_dbs in the parallel validator: diff touched_addresses / storage_reads against header BAL to catch missing pure-access entries and missing storage_reads. - Fall back to pre-state code_hash in validate_tx_execution PART B when the BAL has no code_changes entry (missing_code_change). - Stop whitelisting SYSTEM_ADDRESS from unaccessed_pure_accounts via system_seed / current_accounts_state scrubs; user-tx touches still remove it via the per-tx tracked_accounts path. EIP-8037 (state gas 2D accounting) - Dynamic cost_per_state_byte(block_gas_limit), Amsterdam only. - Two-counter reservoir: state_gas_spill_outstanding + state_gas_credit_against_drain for correct revert math across nested sub-calls (PR #2733 clamp-and-spill). - Per-tx 2D inclusion check (PR #2703) in sequential + parallel paths: reject with GAS_ALLOWANCE_EXCEEDED when tx.gas worst-case exceeds remaining block regular/state budget. - intrinsic_state_gas immutable across the tx (PR #2711) and subtracted separately when deriving block-dimensional regular gas. - CREATE collision/early/child failure refunds account state gas. - Same-tx SELFDESTRUCT refunds state gas clamped against execution-only state gas (PR #2707), not total state_gas_used. - Revert-path reservoir refill uses the PR #2733 X - Z formula. - Top-level reservoir reset on tx failure (PR #2689). - Zero gas_remaining on precompile exceptional halt so block accounting sees the full intrinsic. Calldata / access-list floors - TOTAL_COST_FLOOR_PER_TOKEN 10 -> 16 under Amsterdam (EIP-7976). - Access-list data bytes fold into floor-token count (EIP-7981). EIP-7708 - Lex-ordered burn logs, no coinbase priority-fee log, SELFDESTRUCT- destination coalescing. Tests - New levm tests for EIP-7976/7981, EIP-8037 refund/code-deposit/ top-level-failure paths. - Skip 6 zkevm@v0.3.0 EIP-8025 fixtures filled against bal@v5.6.1 (re-enable once zkevm@v0.4.x ships). Hive consume-engine amsterdam: 1339 pass, 3 remaining (withdrawal missing-entry cases addressed by PR #6463, cherry-pick pending).
edg-l
added a commit
that referenced
this pull request
May 6, 2026
Reverts the state_gas_used and intrinsic_state_gas_charged subtractions introduced in ec5141c. EELS spec at the bal-devnet-6@v1.1.0 fixture-gen commit (ethereum/execution-specs PR #2711) is unambiguous: "intrinsic_state_gas is immutable after validation". The refund only flows to message.state_gas_reservoir; block accounting computes tx_state_gas = intrinsic_state_gas + state_gas_used WITHOUT subtracting the refund. ec5141c made ethrex match geth/besu — but those clients also have this bug per execution-specs#2804 (cross-client bug to fix before bal-devnet-7). The fixtures (= EELS) prove the spec-correct expectation. Concretely fixes the 72 pointer_to_precompile parametrizations and the ~16 state_gas_set_code tests in bal-devnet-6@v1.1.0, all of which expected block.gasUsed to include the full intrinsic_state_gas in the state dimension.
edg-l
added a commit
that referenced
this pull request
May 6, 2026
Reverts the state_gas_used and intrinsic_state_gas_charged subtractions from ec5141c. EELS spec at the bal-devnet-6@v1.1.0 fixture-gen commit (ethereum/execution-specs PR #2711) is explicit: "intrinsic_state_gas is immutable after validation". The refund only flows to message.state_gas_reservoir; block accounting computes tx_state_gas = intrinsic_state_gas + state_gas_used WITHOUT subtracting the refund. Concretely fixes the 72 pointer_to_precompile parametrizations and the state_gas_set_code family in bal-devnet-6@v1.1.0, which expect block.gasUsed to include the full intrinsic_state_gas in the state dimension (max(regular, state) per EIP-7778). NOTE: future spec direction. The bal-devnet-6 spec acknowledges this as a bug locked in for devnet verification only. See ethereum/execution-specs commit 9b3961a65 (added a regression test `test_snobal_block_gas_used_inflated_by_7702_auth_refund`) and its docstring: the intended long-term fix is to add MessageCallOutput.state_refund and subtract it from tx_state_gas, mirroring the SELFDESTRUCT refund pattern. ec5141c was implementing that future behavior; we are reverting it because bal-devnet-6 fixtures (current target) require the un-subtracted value. Re-apply the subtraction when bal-devnet-7 fixtures land with the spec fix.
1 task
edg-l
added a commit
that referenced
this pull request
May 6, 2026
Brings ethrex up to bal-devnet-4 fixture spec. Rolls up EIP-7928, EIP-8037, EIP-7976, EIP-7981, EIP-7708 and misc BAL validation fixes into one change set. BAL (EIP-7928) - Widen BlockAccessIndex and related recorder/index fields to u32. - Shadow BAL recorder on per-tx tx_dbs in the parallel validator: diff touched_addresses / storage_reads against header BAL to catch missing pure-access entries and missing storage_reads. - Fall back to pre-state code_hash in validate_tx_execution PART B when the BAL has no code_changes entry (missing_code_change). - Stop whitelisting SYSTEM_ADDRESS from unaccessed_pure_accounts via system_seed / current_accounts_state scrubs; user-tx touches still remove it via the per-tx tracked_accounts path. EIP-8037 (state gas 2D accounting) - Dynamic cost_per_state_byte(block_gas_limit), Amsterdam only. - Two-counter reservoir: state_gas_spill_outstanding + state_gas_credit_against_drain for correct revert math across nested sub-calls (PR #2733 clamp-and-spill). - Per-tx 2D inclusion check (PR #2703) in sequential + parallel paths: reject with GAS_ALLOWANCE_EXCEEDED when tx.gas worst-case exceeds remaining block regular/state budget. - intrinsic_state_gas immutable across the tx (PR #2711) and subtracted separately when deriving block-dimensional regular gas. - CREATE collision/early/child failure refunds account state gas. - Same-tx SELFDESTRUCT refunds state gas clamped against execution-only state gas (PR #2707), not total state_gas_used. - Revert-path reservoir refill uses the PR #2733 X - Z formula. - Top-level reservoir reset on tx failure (PR #2689). - Zero gas_remaining on precompile exceptional halt so block accounting sees the full intrinsic. Calldata / access-list floors - TOTAL_COST_FLOOR_PER_TOKEN 10 -> 16 under Amsterdam (EIP-7976). - Access-list data bytes fold into floor-token count (EIP-7981). EIP-7708 - Lex-ordered burn logs, no coinbase priority-fee log, SELFDESTRUCT- destination coalescing. Tests - New levm tests for EIP-7976/7981, EIP-8037 refund/code-deposit/ top-level-failure paths. - Skip 6 zkevm@v0.3.0 EIP-8025 fixtures filled against bal@v5.6.1 (re-enable once zkevm@v0.4.x ships). Hive consume-engine amsterdam: 1339 pass, 3 remaining (withdrawal missing-entry cases addressed by PR #6463, cherry-pick pending).
edg-l
added a commit
that referenced
this pull request
May 6, 2026
Reverts the state_gas_used and intrinsic_state_gas_charged subtractions from ec5141c. EELS spec at the bal-devnet-6@v1.1.0 fixture-gen commit (ethereum/execution-specs PR #2711) is explicit: "intrinsic_state_gas is immutable after validation". The refund only flows to message.state_gas_reservoir; block accounting computes tx_state_gas = intrinsic_state_gas + state_gas_used WITHOUT subtracting the refund. Concretely fixes the 72 pointer_to_precompile parametrizations and the state_gas_set_code family in bal-devnet-6@v1.1.0, which expect block.gasUsed to include the full intrinsic_state_gas in the state dimension (max(regular, state) per EIP-7778). NOTE: future spec direction. The bal-devnet-6 spec acknowledges this as a bug locked in for devnet verification only. See ethereum/execution-specs commit 9b3961a65 (added a regression test `test_snobal_block_gas_used_inflated_by_7702_auth_refund`) and its docstring: the intended long-term fix is to add MessageCallOutput.state_refund and subtract it from tx_state_gas, mirroring the SELFDESTRUCT refund pattern. ec5141c was implementing that future behavior; we are reverting it because bal-devnet-6 fixtures (current target) require the un-subtracted value. Re-apply the subtraction when bal-devnet-7 fixtures land with the spec fix.
edg-l
added a commit
that referenced
this pull request
May 6, 2026
Reverts the state_gas_used and intrinsic_state_gas_charged subtractions from ec5141c. EELS spec at the bal-devnet-6@v1.1.0 fixture-gen commit (ethereum/execution-specs PR #2711) is explicit: "intrinsic_state_gas is immutable after validation". The refund only flows to message.state_gas_reservoir; block accounting computes tx_state_gas = intrinsic_state_gas + state_gas_used WITHOUT subtracting the refund. Concretely fixes the 72 pointer_to_precompile parametrizations and the state_gas_set_code family in bal-devnet-6@v1.1.0, which expect block.gasUsed to include the full intrinsic_state_gas in the state dimension (max(regular, state) per EIP-7778). NOTE: future spec direction. The bal-devnet-6 spec acknowledges this as a bug locked in for devnet verification only. See ethereum/execution-specs commit 9b3961a65 (added a regression test `test_snobal_block_gas_used_inflated_by_7702_auth_refund`) and its docstring: the intended long-term fix is to add MessageCallOutput.state_refund and subtract it from tx_state_gas, mirroring the SELFDESTRUCT refund pattern. ec5141c was implementing that future behavior; we are reverting it because bal-devnet-6 fixtures (current target) require the un-subtracted value. Re-apply the subtraction when bal-devnet-7 fixtures land with the spec fix.
edg-l
added a commit
that referenced
this pull request
May 6, 2026
…_used / intrinsic_state_gas_charged Re-applies ec5141c. Lines up with EELS PR #2711 future direction (MessageCallOutput.state_refund subtracted from tx_state_gas, mirroring SELFDESTRUCT). Bal-devnet-6 fixtures still expect the un-subtracted value, so the affected ef-tests will be allowlisted via the known-fails mechanism with a citation to execution-specs commit 9b3961a65 (test_snobal_block_gas_used_inflated_by_7702_auth_refund) which locks in the devnet-6 quirk.
edg-l
added a commit
that referenced
this pull request
May 7, 2026
Brings ethrex up to bal-devnet-4 fixture spec. Rolls up EIP-7928, EIP-8037, EIP-7976, EIP-7981, EIP-7708 and misc BAL validation fixes into one change set. BAL (EIP-7928) - Widen BlockAccessIndex and related recorder/index fields to u32. - Shadow BAL recorder on per-tx tx_dbs in the parallel validator: diff touched_addresses / storage_reads against header BAL to catch missing pure-access entries and missing storage_reads. - Fall back to pre-state code_hash in validate_tx_execution PART B when the BAL has no code_changes entry (missing_code_change). - Stop whitelisting SYSTEM_ADDRESS from unaccessed_pure_accounts via system_seed / current_accounts_state scrubs; user-tx touches still remove it via the per-tx tracked_accounts path. EIP-8037 (state gas 2D accounting) - Dynamic cost_per_state_byte(block_gas_limit), Amsterdam only. - Two-counter reservoir: state_gas_spill_outstanding + state_gas_credit_against_drain for correct revert math across nested sub-calls (PR #2733 clamp-and-spill). - Per-tx 2D inclusion check (PR #2703) in sequential + parallel paths: reject with GAS_ALLOWANCE_EXCEEDED when tx.gas worst-case exceeds remaining block regular/state budget. - intrinsic_state_gas immutable across the tx (PR #2711) and subtracted separately when deriving block-dimensional regular gas. - CREATE collision/early/child failure refunds account state gas. - Same-tx SELFDESTRUCT refunds state gas clamped against execution-only state gas (PR #2707), not total state_gas_used. - Revert-path reservoir refill uses the PR #2733 X - Z formula. - Top-level reservoir reset on tx failure (PR #2689). - Zero gas_remaining on precompile exceptional halt so block accounting sees the full intrinsic. Calldata / access-list floors - TOTAL_COST_FLOOR_PER_TOKEN 10 -> 16 under Amsterdam (EIP-7976). - Access-list data bytes fold into floor-token count (EIP-7981). EIP-7708 - Lex-ordered burn logs, no coinbase priority-fee log, SELFDESTRUCT- destination coalescing. Tests - New levm tests for EIP-7976/7981, EIP-8037 refund/code-deposit/ top-level-failure paths. - Skip 6 zkevm@v0.3.0 EIP-8025 fixtures filled against bal@v5.6.1 (re-enable once zkevm@v0.4.x ships). Hive consume-engine amsterdam: 1339 pass, 3 remaining (withdrawal missing-entry cases addressed by PR #6463, cherry-pick pending).
edg-l
added a commit
that referenced
this pull request
May 7, 2026
Reverts the state_gas_used and intrinsic_state_gas_charged subtractions from ec5141c. EELS spec at the bal-devnet-6@v1.1.0 fixture-gen commit (ethereum/execution-specs PR #2711) is explicit: "intrinsic_state_gas is immutable after validation". The refund only flows to message.state_gas_reservoir; block accounting computes tx_state_gas = intrinsic_state_gas + state_gas_used WITHOUT subtracting the refund. Concretely fixes the 72 pointer_to_precompile parametrizations and the state_gas_set_code family in bal-devnet-6@v1.1.0, which expect block.gasUsed to include the full intrinsic_state_gas in the state dimension (max(regular, state) per EIP-7778). NOTE: future spec direction. The bal-devnet-6 spec acknowledges this as a bug locked in for devnet verification only. See ethereum/execution-specs commit 9b3961a65 (added a regression test `test_snobal_block_gas_used_inflated_by_7702_auth_refund`) and its docstring: the intended long-term fix is to add MessageCallOutput.state_refund and subtract it from tx_state_gas, mirroring the SELFDESTRUCT refund pattern. ec5141c was implementing that future behavior; we are reverting it because bal-devnet-6 fixtures (current target) require the un-subtracted value. Re-apply the subtraction when bal-devnet-7 fixtures land with the spec fix.
edg-l
added a commit
that referenced
this pull request
May 7, 2026
…_used / intrinsic_state_gas_charged Re-applies ec5141c. Lines up with EELS PR #2711 future direction (MessageCallOutput.state_refund subtracted from tx_state_gas, mirroring SELFDESTRUCT). Bal-devnet-6 fixtures still expect the un-subtracted value, so the affected ef-tests will be allowlisted via the known-fails mechanism with a citation to execution-specs commit 9b3961a65 (test_snobal_block_gas_used_inflated_by_7702_auth_refund) which locks in the devnet-6 quirk.
edg-l
added a commit
that referenced
this pull request
May 7, 2026
Brings ethrex up to bal-devnet-4 fixture spec. Rolls up EIP-7928, EIP-8037, EIP-7976, EIP-7981, EIP-7708 and misc BAL validation fixes into one change set. BAL (EIP-7928) - Widen BlockAccessIndex and related recorder/index fields to u32. - Shadow BAL recorder on per-tx tx_dbs in the parallel validator: diff touched_addresses / storage_reads against header BAL to catch missing pure-access entries and missing storage_reads. - Fall back to pre-state code_hash in validate_tx_execution PART B when the BAL has no code_changes entry (missing_code_change). - Stop whitelisting SYSTEM_ADDRESS from unaccessed_pure_accounts via system_seed / current_accounts_state scrubs; user-tx touches still remove it via the per-tx tracked_accounts path. EIP-8037 (state gas 2D accounting) - Dynamic cost_per_state_byte(block_gas_limit), Amsterdam only. - Two-counter reservoir: state_gas_spill_outstanding + state_gas_credit_against_drain for correct revert math across nested sub-calls (PR #2733 clamp-and-spill). - Per-tx 2D inclusion check (PR #2703) in sequential + parallel paths: reject with GAS_ALLOWANCE_EXCEEDED when tx.gas worst-case exceeds remaining block regular/state budget. - intrinsic_state_gas immutable across the tx (PR #2711) and subtracted separately when deriving block-dimensional regular gas. - CREATE collision/early/child failure refunds account state gas. - Same-tx SELFDESTRUCT refunds state gas clamped against execution-only state gas (PR #2707), not total state_gas_used. - Revert-path reservoir refill uses the PR #2733 X - Z formula. - Top-level reservoir reset on tx failure (PR #2689). - Zero gas_remaining on precompile exceptional halt so block accounting sees the full intrinsic. Calldata / access-list floors - TOTAL_COST_FLOOR_PER_TOKEN 10 -> 16 under Amsterdam (EIP-7976). - Access-list data bytes fold into floor-token count (EIP-7981). EIP-7708 - Lex-ordered burn logs, no coinbase priority-fee log, SELFDESTRUCT- destination coalescing. Tests - New levm tests for EIP-7976/7981, EIP-8037 refund/code-deposit/ top-level-failure paths. - Skip 6 zkevm@v0.3.0 EIP-8025 fixtures filled against bal@v5.6.1 (re-enable once zkevm@v0.4.x ships). Hive consume-engine amsterdam: 1339 pass, 3 remaining (withdrawal missing-entry cases addressed by PR #6463, cherry-pick pending).
edg-l
added a commit
that referenced
this pull request
May 7, 2026
Reverts the state_gas_used and intrinsic_state_gas_charged subtractions from ec5141c. EELS spec at the bal-devnet-6@v1.1.0 fixture-gen commit (ethereum/execution-specs PR #2711) is explicit: "intrinsic_state_gas is immutable after validation". The refund only flows to message.state_gas_reservoir; block accounting computes tx_state_gas = intrinsic_state_gas + state_gas_used WITHOUT subtracting the refund. Concretely fixes the 72 pointer_to_precompile parametrizations and the state_gas_set_code family in bal-devnet-6@v1.1.0, which expect block.gasUsed to include the full intrinsic_state_gas in the state dimension (max(regular, state) per EIP-7778). NOTE: future spec direction. The bal-devnet-6 spec acknowledges this as a bug locked in for devnet verification only. See ethereum/execution-specs commit 9b3961a65 (added a regression test `test_snobal_block_gas_used_inflated_by_7702_auth_refund`) and its docstring: the intended long-term fix is to add MessageCallOutput.state_refund and subtract it from tx_state_gas, mirroring the SELFDESTRUCT refund pattern. ec5141c was implementing that future behavior; we are reverting it because bal-devnet-6 fixtures (current target) require the un-subtracted value. Re-apply the subtraction when bal-devnet-7 fixtures land with the spec fix.
edg-l
added a commit
that referenced
this pull request
May 7, 2026
…_used / intrinsic_state_gas_charged Re-applies ec5141c. Lines up with EELS PR #2711 future direction (MessageCallOutput.state_refund subtracted from tx_state_gas, mirroring SELFDESTRUCT). Bal-devnet-6 fixtures still expect the un-subtracted value, so the affected ef-tests will be allowlisted via the known-fails mechanism with a citation to execution-specs commit 9b3961a65 (test_snobal_block_gas_used_inflated_by_7702_auth_refund) which locks in the devnet-6 quirk.
edg-l
added a commit
that referenced
this pull request
May 8, 2026
Brings ethrex up to bal-devnet-4 fixture spec. Rolls up EIP-7928, EIP-8037, EIP-7976, EIP-7981, EIP-7708 and misc BAL validation fixes into one change set. BAL (EIP-7928) - Widen BlockAccessIndex and related recorder/index fields to u32. - Shadow BAL recorder on per-tx tx_dbs in the parallel validator: diff touched_addresses / storage_reads against header BAL to catch missing pure-access entries and missing storage_reads. - Fall back to pre-state code_hash in validate_tx_execution PART B when the BAL has no code_changes entry (missing_code_change). - Stop whitelisting SYSTEM_ADDRESS from unaccessed_pure_accounts via system_seed / current_accounts_state scrubs; user-tx touches still remove it via the per-tx tracked_accounts path. EIP-8037 (state gas 2D accounting) - Dynamic cost_per_state_byte(block_gas_limit), Amsterdam only. - Two-counter reservoir: state_gas_spill_outstanding + state_gas_credit_against_drain for correct revert math across nested sub-calls (PR #2733 clamp-and-spill). - Per-tx 2D inclusion check (PR #2703) in sequential + parallel paths: reject with GAS_ALLOWANCE_EXCEEDED when tx.gas worst-case exceeds remaining block regular/state budget. - intrinsic_state_gas immutable across the tx (PR #2711) and subtracted separately when deriving block-dimensional regular gas. - CREATE collision/early/child failure refunds account state gas. - Same-tx SELFDESTRUCT refunds state gas clamped against execution-only state gas (PR #2707), not total state_gas_used. - Revert-path reservoir refill uses the PR #2733 X - Z formula. - Top-level reservoir reset on tx failure (PR #2689). - Zero gas_remaining on precompile exceptional halt so block accounting sees the full intrinsic. Calldata / access-list floors - TOTAL_COST_FLOOR_PER_TOKEN 10 -> 16 under Amsterdam (EIP-7976). - Access-list data bytes fold into floor-token count (EIP-7981). EIP-7708 - Lex-ordered burn logs, no coinbase priority-fee log, SELFDESTRUCT- destination coalescing. Tests - New levm tests for EIP-7976/7981, EIP-8037 refund/code-deposit/ top-level-failure paths. - Skip 6 zkevm@v0.3.0 EIP-8025 fixtures filled against bal@v5.6.1 (re-enable once zkevm@v0.4.x ships). Hive consume-engine amsterdam: 1339 pass, 3 remaining (withdrawal missing-entry cases addressed by PR #6463, cherry-pick pending).
edg-l
added a commit
that referenced
this pull request
May 8, 2026
Reverts the state_gas_used and intrinsic_state_gas_charged subtractions from ec5141c. EELS spec at the bal-devnet-6@v1.1.0 fixture-gen commit (ethereum/execution-specs PR #2711) is explicit: "intrinsic_state_gas is immutable after validation". The refund only flows to message.state_gas_reservoir; block accounting computes tx_state_gas = intrinsic_state_gas + state_gas_used WITHOUT subtracting the refund. Concretely fixes the 72 pointer_to_precompile parametrizations and the state_gas_set_code family in bal-devnet-6@v1.1.0, which expect block.gasUsed to include the full intrinsic_state_gas in the state dimension (max(regular, state) per EIP-7778). NOTE: future spec direction. The bal-devnet-6 spec acknowledges this as a bug locked in for devnet verification only. See ethereum/execution-specs commit 9b3961a65 (added a regression test `test_snobal_block_gas_used_inflated_by_7702_auth_refund`) and its docstring: the intended long-term fix is to add MessageCallOutput.state_refund and subtract it from tx_state_gas, mirroring the SELFDESTRUCT refund pattern. ec5141c was implementing that future behavior; we are reverting it because bal-devnet-6 fixtures (current target) require the un-subtracted value. Re-apply the subtraction when bal-devnet-7 fixtures land with the spec fix.
edg-l
added a commit
that referenced
this pull request
May 8, 2026
…_used / intrinsic_state_gas_charged Re-applies ec5141c. Lines up with EELS PR #2711 future direction (MessageCallOutput.state_refund subtracted from tx_state_gas, mirroring SELFDESTRUCT). Bal-devnet-6 fixtures still expect the un-subtracted value, so the affected ef-tests will be allowlisted via the known-fails mechanism with a citation to execution-specs commit 9b3961a65 (test_snobal_block_gas_used_inflated_by_7702_auth_refund) which locks in the devnet-6 quirk.
edg-l
added a commit
that referenced
this pull request
May 11, 2026
bal-devnet-6 EELS spec (`devnets/bal/6` `eoa_delegation.py`) only does `message.state_gas_reservoir += STATE_BYTES_PER_NEW_ACCOUNT × cpsb` on each existing-authority refund. Docstring: "no mutation of intrinsic_state_gas". Drops the two extra subtractions previously added in `cefdf69de` that anticipated EELS PR #2711 / #2816 (the bal-7 `state_refund` channel). For bal-6 the block-level `state_gas_used` intentionally stays "inflated" by the auth refund — the refund is sender-side only in this devnet. Block-accounting subtraction lands in bal-devnet-7 via the separate `state_refund` channel. Unblocks the snobal-devnet-6 EIP-7702 fixtures previously allowlisted under "bal-devnet-6 known-failing fixtures (Amsterdam fork only)" in tooling/ef_tests/blockchain/tests/all.rs.
5 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.
Motivation
On #2586 new tests were added and some of them regarding the EIP-7702 and precompiles were failing in LEVM.
Description
eip7702_set_code_tx/set_code_txs/set_code_to_precompile.jsonwere failing because we were not transferring WEI when the target address of a delegation was one of the precompiles. As a result, balances were not updated, causing an incorrect state root.eip7702_set_code_tx/set_code_txs/set_code_to_precompile_not_enough_gas_for_precompile_execution.jsonwere failing because when a precompile was the target of a delegation, and its execution failed a revert was returned. This caused an incorrect receipts root because if a precompile fails in this context, a success should be returned.Closes #2691