Skip to content

fix(anvil): isolate fork caches by endpoint - #15931

Merged
grandizzy merged 1 commit into
masterfrom
mablr/isolate-anvil-fork-cache
Jul 28, 2026
Merged

fix(anvil): isolate fork caches by endpoint#15931
grandizzy merged 1 commit into
masterfrom
mablr/isolate-anvil-fork-cache

Conversation

@mablr

@mablr mablr commented Jul 28, 2026

Copy link
Copy Markdown
Member

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.

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>
@github-actions

Copy link
Copy Markdown
Contributor

✅ Changelog found

The deterministic check will validate the changed entry.

@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

@grandizzy
grandizzy enabled auto-merge (squash) July 28, 2026 10:06

@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.

lgtm

@grandizzy
grandizzy merged commit e617011 into master Jul 28, 2026
24 checks passed
@grandizzy
grandizzy deleted the mablr/isolate-anvil-fork-cache branch July 28, 2026 10:18
@github-project-automation github-project-automation Bot moved this to Done in Foundry Jul 28, 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.

3 participants