Skip to content

fix(anvil): canonicalize eth_simulateV1 state roots - #15934

Merged
mablr merged 9 commits into
masterfrom
mablr/oss-598-canonicalize-anvil-state-roots-used-by-eth_simulatev1
Jul 29, 2026
Merged

fix(anvil): canonicalize eth_simulateV1 state roots#15934
mablr merged 9 commits into
masterfrom
mablr/oss-598-canonicalize-anvil-state-roots-used-by-eth_simulatev1

Conversation

@mablr

@mablr mablr commented Jul 28, 2026

Copy link
Copy Markdown
Member

Description

Anvil constructed simulated state roots from incomplete candidate overlays and retained zero-valued storage or deleted accounts in trie inputs, producing non-canonical headers. This recursively merges candidate and base state, applies canonical absence rules across full, incremental, and historical paths, and returns the resulting root from local eth_simulateV1 responses. Coverage includes storage updates and deletions plus London SELFDESTRUCT parity between simulated and mined roots.

Closes OSS-598. Fork-backed root policy and broader response assembly remain in OSS-565; block transitions, blob handling, and mining finalization are unchanged.

Build simulated roots from the recursively merged candidate state and omit deleted accounts and zero-valued storage leaves from full, incremental, and historical tries.
@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

✅ Changelog found

The deterministic check will validate the changed entry.

mattsse
mattsse previously approved these changes Jul 28, 2026

@mattsse mattsse left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@mablr
mablr enabled auto-merge (squash) July 28, 2026 14:02
@mablr
mablr requested a review from mattsse July 28, 2026 14:02

@mablr mablr left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sorry @mattsse I forgot the changelog.

…ts-used-by-eth_simulatev1

# Conflicts:
#	crates/anvil/src/eth/backend/mem/mod.rs
Comment thread crates/anvil/src/eth/backend/mem/in_memory_db.rs Outdated
Comment thread crates/anvil/src/eth/backend/db.rs
Retain historical tombstones internally and carry storage-cleared provenance across simulated calls so deleted accounts and storage cannot be reconstructed as live state.
@mablr
mablr requested a review from stevencartavia July 28, 2026 20:12
Comment thread crates/anvil/src/eth/backend/mem/mod.rs Outdated
@grandizzy

Copy link
Copy Markdown
Collaborator

cyclops audit fast

@grandizzy

Copy link
Copy Markdown
Collaborator

cyclops audit fast

mablr added 2 commits July 29, 2026 10:54
State overrides could turn deleted accounts into partial overlays and reload storage from the simulation base. Preserve storage-cleared provenance across override commits and cover code-only overrides after SELFDESTRUCT.
Comment thread crates/anvil/src/eth/backend/mem/mod.rs
Empty account overrides were committed as touched accounts, changing eth_simulateV1 state roots despite requesting no mutation. Filter no-op entries after precompile move extraction and cover root parity over HTTP.
@mablr
mablr requested a review from stevencartavia July 29, 2026 12:06
@mablr
mablr requested a review from figtracer July 29, 2026 12:06

@mattsse mattsse left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@mablr
mablr merged commit b2258a8 into master Jul 29, 2026
24 checks passed
@mablr
mablr deleted the mablr/oss-598-canonicalize-anvil-state-roots-used-by-eth_simulatev1 branch July 29, 2026 17:00
@github-project-automation github-project-automation Bot moved this to Done in Foundry Jul 29, 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.

5 participants