fix(anvil): make fork resets atomic - #15919
Draft
mablr wants to merge 15 commits into
Draft
Conversation
Contributor
✅ Changelog foundThe deterministic check will validate the changed entry. |
mablr
marked this pull request as ready for review
July 27, 2026 21:16
mablr
requested review from
0xrusowsky,
DaniPopes,
figtracer,
grandizzy,
mattsse and
stevencartavia
as code owners
July 27, 2026 21:16
mattsse
requested changes
Jul 27, 2026
mattsse
left a comment
Member
There was a problem hiding this comment.
One fork cache isolation regression.
Prevent retired fork backends from overwriting replacement state by assigning each RPC endpoint its own persisted cache file. Keep cache reporting compatible with legacy and endpoint-specific files. Amp-Thread-ID: https://ampcode.com/threads/T-019fa7db-8788-7159-b3d6-5dcdeb97c522 Co-authored-by: Amp <amp@ampcode.com>
Prepare fork configuration, database, EVM environment, and fee state without mutating the live backend. Publish the candidate only after setup succeeds so failed resets preserve the active node state.
FeeManager is constructed before a historical fork's hardfork is detected, which leaves its fee calculations on the default spec. Share the active spec across clones and update it during fork setup so pre-London simulations cannot derive EIP-1559 base fees. Replace the ineffective empty-block check with a local historical fork regression that carries a nonzero base fee override into the following simulated block.
Preserve fork database RPC provenance across mutable configuration updates. Snapshot the active shared blob parameters for each fee-history entry so hardfork-changing resets use the target fork's schedule. Amp-Thread-ID: https://ampcode.com/threads/T-019fa7db-8788-7159-b3d6-5dcdeb97c522 Co-authored-by: Amp <amp@ampcode.com>
mablr
force-pushed
the
mablr/fix-anvil-reset-atomicity
branch
from
July 28, 2026 09:42
87e6077 to
fe27231
Compare
mablr
marked this pull request as draft
July 28, 2026 09:46
Keep network-family provenance and EIP-1559 parameters synchronized across fork resets. Reject unsupported inferred network-family changes before publishing candidate state.
# Conflicts: # crates/anvil/src/config.rs # crates/anvil/src/eth/api.rs # crates/anvil/src/eth/backend/fork.rs # crates/anvil/src/eth/backend/mem/mod.rs # crates/anvil/src/eth/miner.rs # crates/anvil/src/lib.rs # crates/anvil/tests/it/eip4844.rs # crates/anvil/tests/it/optimism.rs # crates/anvil/tests/it/simulate.rs
# Conflicts: # crates/anvil/src/config.rs # crates/anvil/src/eth/api.rs # crates/anvil/src/eth/backend/fork.rs # crates/anvil/src/eth/backend/mem/mod.rs # crates/anvil/src/eth/fees.rs # crates/anvil/src/eth/miner.rs # crates/anvil/src/service.rs # crates/anvil/tests/it/simulate.rs
Amp-Thread-ID: https://ampcode.com/threads/T-019ff4ec-c3e3-773f-8805-247b7dbe62d9 Co-authored-by: Amp <amp@ampcode.com> # Conflicts: # crates/anvil/src/config.rs # crates/anvil/src/eth/api.rs # crates/anvil/src/eth/backend/fork.rs # crates/anvil/src/eth/backend/genesis.rs # crates/anvil/src/eth/backend/mem/mod.rs # crates/anvil/src/eth/fees.rs # crates/anvil/src/eth/sign.rs # crates/anvil/src/lib.rs # crates/anvil/tests/it/gas.rs
mablr
added a commit
that referenced
this pull request
Aug 12, 2026
Drop the missing-hash reset regression that belongs to the broader atomic reset work in #15919. The exact-fork ancestry fix continues to validate the resolved hash inside the existing staged reset path.
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.
Anvil currently mutates live fork metadata and fee state while
anvil_resetis still performing asynchronous, fallible setup. A failed reset can therefore expose partially updated node state, and reset can race active mining.This prepares the candidate configuration, database, EVM environment, genesis allocation, and fee state independently, then publishes them only after setup succeeds. It also preserves chain-ID override and database RPC provenance, keeps local signers aligned with the active chain after a reset, delays instance-ID changes until the backend commits successfully, and snapshots active blob parameters for each fee-history entry.
This includes #15908, which adds target-fork hardfork and fee inference on top of the atomic reset path. It is stacked on #15931, which isolates persisted fork caches by endpoint so publishing a replacement cannot later be contaminated by the retired database's final cache flush.
This PR was written with Amp, which assisted with code generation, tests, and review. PR responses may also be generated with Amp.