feat: update BlockTags during reorgs to prevent stale tag window#96
Merged
feat: update BlockTags during reorgs to prevent stale tag window#96
Conversation
Add `BlockTags::rewind_to(ancestor)` that caps all three tags (latest, safe, finalized) at a given block number using `fetch_min`. Stores run in reverse order (latest → safe → finalized) compared to `update_all` so readers never observe `latest < finalized` while values decrease. Called in `on_host_revert` after `drain_above` but before `notify_reorg` so RPC consumers always see tags consistent with storage. Closes ENG-1969 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fraser999
reviewed
Mar 10, 2026
The previous order (latest → safe → finalized) allowed readers to momentarily observe latest < finalized during a rewind. Reorder to finalized → safe → latest so the invariant is maintained. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Mar 10, 2026
Fraser999
approved these changes
Mar 10, 2026
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.
Summary
BlockTags::rewind_to(ancestor)method that caps all three tags at a given block number usingfetch_min, with stores ordered latest → safe → finalized (reverse ofupdate_all) to prevent readers from ever seeinglatest < finalizedrewind_toinon_host_revertafterdrain_abovebut beforenotify_reorg, closing the window wherelatestcould point to a non-existent blockCloses ENG-1969
Stack
This is the base PR in a stack of 4:
BlockTags::rewind_tofor reorg tag updatesSubscriptionTaskreorg handling (includes feat: update BlockTags during reorgs to prevent stale tag window #96)get_filter_changesreorg watermark (includes feat: update BlockTags during reorgs to prevent stale tag window #96, feat: handle ChainEvent::Reorg in SubscriptionTask #97)Test plan
cargo clippy -p signet-rpc --all-features --all-targets— cleancargo clippy -p signet-rpc --no-default-features --all-targets— cleancargo clippy -p signet-node --all-features --all-targets— cleancargo t -p signet-rpc— 35 unit + 4 doc tests passcargo +nightly fmt— cleansignet-node-tests(require full reth host setup)🤖 Generated with Claude Code