fix: Refactor block height retrieval with blockchain service#417
fix: Refactor block height retrieval with blockchain service#417ianhe8x merged 1 commit intosubquery:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughModified the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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 |
|
This helped me to investigate the issue, might be useful: |
|
good catch. |
Description
When POI (Proof of Index) is not enabled and a fork is detected, the Ethereum unfinalized blocks service was returning a partial header object containing only
blockHeightforces it to interpret as Header type.The
Headertype requiresblockHeight,blockHash,parentHash, andtimestamp. Downstream (@node-core'sinitandreindex) expects a full header; receiving onlyblockHeightcaused "Node failed to start" and broken rewind behaviour.https://github.com/subquery/subql/blob/f136cbb1ff98d685cd5bcbe5a855feb5386b1989/packages/node-core/src/utils/blocks.ts#L57
Fix: Use the blockchain service to fetch a full header for the rewind height instead of constructing a partial object:
No new dependencies. Relevant context: unfinalized block rewind flow in node-core, and the
Headertype contract in@subql/node-core.Fixes # (issue)
Type of change
Please delete options that are not relevant.
Checklist
Summary by CodeRabbit