Expand rollback guard documentation with reorg detection guide#802
Expand rollback guard documentation with reorg detection guide#802
Conversation
…etection Expand the Rollback Guard section in the HyperSync query docs to explain how HyperSync handles chain reorgs internally, the data consistency guarantee within a single query, how to detect reorgs using first_parent_hash comparison, and a step-by-step guide with pseudocode for handling detected reorgs. Also adds cross-reference from the HyperIndex reorgs-support page and updates the LLM documentation. https://claude.ai/code/session_01FubCA6TsvCKBgVFYFA1gvx
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| # Store rollback guards from recent queries | ||
| rollback_history = [] # list of (block_number, hash) tuples | ||
|
|
||
| while True: |
There was a problem hiding this comment.
Need to check this code 🍇 All AI
JasoonS
left a comment
There was a problem hiding this comment.
This update needs some love, but also need to get going soon.
| When a reorg is detected, the rollback guard tells you *that* a reorg happened, but not *which specific block* was reorganized. To handle this: | ||
|
|
||
| 1. **Store the rollback guard from every recent query** — keep enough history to cover the reorg threshold for your chain (e.g., up to 200 blocks for Polygon). | ||
| 2. **Walk backwards through stored rollback guards** to find the first query whose block hash no longer matches the chain. |
There was a problem hiding this comment.
Need to refine this step, it'll always only be the latest rollback guard that doesn't match, but a query to hypersync needs to check all the recent blockhashes to find out exactly where the reorg happend (while looking at the previous reorg guards, or stored hashes).
Summary
Significantly expanded documentation for the
rollback_guardfeature across HyperSync and HyperIndex docs to provide comprehensive guidance on detecting and handling chain reorganizations (reorgs).Key Changes
Notable Details
https://claude.ai/code/session_01FubCA6TsvCKBgVFYFA1gvx