Skip to content

fix(anvil): prepare local block replays - #15899

Merged
mablr merged 6 commits into
foundry-rs:masterfrom
haythemsellami:agent/fix-anvil-replay-preexecution
Jul 30, 2026
Merged

fix(anvil): prepare local block replays#15899
mablr merged 6 commits into
foundry-rs:masterfrom
haythemsellami:agent/fix-anvil-replay-preexecution

Conversation

@haythemsellami

@haythemsellami haythemsellami commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Local parity block replay and opcode-gas replay start from the parent state but currently skip the protocol pre-execution performed during mining. This change prepares both replay databases through the network-aware block executor before applying transactions, keeping EIP-2935 and future pre-execution behavior aligned with mined execution. Executor preparation is fallible so real preparation and execution failures propagate as JSON-RPC errors instead of panicking or being treated as missing state.

The regressions cover the EIP-2935 parent-hash state change and deterministic pre-execution failures across block replay, transaction replay, and opcode-gas replay. Closes #15894.

Comment thread crates/anvil/src/eth/backend/mem/mod.rs Outdated
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

✅ Changelog found

The deterministic check will validate the changed entry.

@haythemsellami

Copy link
Copy Markdown
Contributor Author

Updated in 72f8344c1: block-executor setup is now fallible, and replay callers propagate preparation and finalization failures as JSON-RPC internal errors. The parity helpers distinguish genuine absence from execution failures, while opcode-gas and the other fallible replay paths propagate the same error. HTTP coverage now exercises block replay, transaction replay, and opcode-gas replay with a deterministic EIP-2935 pre-execution failure and confirms the node remains responsive.

mablr
mablr previously approved these changes Jul 29, 2026

@grandizzy grandizzy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, please check finding inline

Comment thread crates/anvil/src/eth/backend/mem/mod.rs
Parity and opcode-gas block replay started from the parent state but skipped protocol pre-execution. Prepare both replay databases through the network-aware block executor so EIP-2935 and future pre-execution changes match mining semantics.
Make block executor setup fallible and propagate preparation failures through local replay APIs instead of panicking or treating them as missing state. Cover parity block and transaction replay plus opcode-gas replay through JSON-RPC.
Route post-genesis empty blocks through block replay preparation so protocol pre-execution failures are returned by trace_blockOpcodeGas. Preserve the genesis fast path because genesis has no parent state to replay.
@mablr
mablr enabled auto-merge (squash) July 30, 2026 07:32
@mablr
mablr merged commit c7c43e4 into foundry-rs:master Jul 30, 2026
25 checks passed
@github-project-automation github-project-automation Bot moved this to Done in Foundry Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug(anvil): local block replay skips pre-execution

4 participants