You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(host-rpc): rewrite notifier with hash-based chain walking
Replace fetch-by-number with hash-anchored backward walk, eliminating
TOCTOU race conditions in reorg detection. The subscription is now a
wake-up signal; on each event the notifier walks from the hint hash
backward until it finds overlap with a lightweight (u64, B256) ring
buffer. Full blocks are fetched by hash only for the new segment.
Key changes:
- Hash-based walk algorithm (WalkResult enum: Advance/Reorg/Exhausted)
- Parallel block+receipt fetches via tokio::try_join! and FuturesOrdered
- Self-healing buffer exhaustion: clears state and re-enters backfill
- Backfill stops at (latest - buffer_capacity), frontfill bridges gap
- set_backfill_thresholds(None) resets to default per trait contract
- fetch_range guards against from > to underflow
- Segment: non-empty invariant enforced, pub(crate) visibility
- Error: removed dead SubscriptionClosed/ReorgTooDeep variants
- Builder: genesis_timestamp validation, uses pub(crate) constructor
- Shared constants in lib.rs, private notifier fields
- Tracing instrumentation on walk and notification methods
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments