fix(anvil): isolate fork caches by endpoint - #15931
Merged
Merged
Conversation
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>
mablr
requested review from
0xrusowsky,
DaniPopes,
figtracer,
grandizzy,
mattsse and
stevencartavia
as code owners
July 28, 2026 09:38
Contributor
✅ Changelog foundThe deterministic check will validate the changed entry. |
grandizzy
enabled auto-merge (squash)
July 28, 2026 10:06
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.
Persisted fork caches are currently keyed only by chain ID and block number, allowing databases backed by different RPC endpoints to share a writer. A retired database can consequently recreate stale endpoint state when its final cache guard is dropped.
This keys Anvil cache files by a hash of the primary RPC URL, keeps legacy and endpoint-specific files visible to cache reporting, and adds block-zero coverage that starts another fork while the replacement remains alive. Existing legacy files remain manageable but are intentionally not reused by Anvil because their endpoint provenance is ambiguous.
This is a prerequisite for #15919: atomic fork publication can otherwise drop the retired database after constructing its replacement and recreate the stale shared cache.
This PR was written with Amp, which assisted with code generation, tests, and review. PR responses may also be generated with Amp.