fix: preserve historical anvil state across suspends - #89
Merged
Conversation
Suspend/resume kept blocks and logs but dropped historical state, so eth_call at any pre-restart block failed with BlockOutOfRangeError — breaking indexers that replay chain history (bit the bullish staging indexer today). Verified locally: with the flag, a killed-and-resumed anvil answers eth_getBalance at pre-restart blocks; without it, the same query fails. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Adds
--preserve-historical-statesto the anvil args.The idle suspend kills anvil and resumes it from
--state state.json, which restores blocks and logs but not historical state — after any resume,eth_callat a pre-restart block fails withBlockOutOfRangeError. Any indexer replaying chain history breaks (the bullish staging Ponder indexer hit this today: it backfills events from block 0 and pins reads to each event's block).Verified locally with anvil v1.7: mine + transact, kill, resume with the flag →
eth_getBalanceat pre-restart blocks returns correct historical values; without the flag the same query fails.Note for existing stacks: state dropped by past suspends is unrecoverable — the flag only protects history written after it's in effect. Chains that need queryable history from genesis have to be reset once.
🤖 Generated with Claude Code