-
Notifications
You must be signed in to change notification settings - Fork 69
consensus: fix missing block header error in vote verification, fix #1850 #1891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 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 |
89063f8 to
8f7a323
Compare
7f63d42 to
6a176e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses spurious error logs that occur when vote messages arrive before their corresponding block headers during normal network operations. The fix adds an early check to defer vote verification when the referenced header is not yet available locally, preventing misleading error messages and allowing the vote to be retried once the header arrives.
Key Changes:
- Added header presence check before epoch info lookup in vote verification
- Changed logging from ERROR to DEBUG level for the normal timing scenario where votes arrive before headers
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if chain.GetHeaderByHash(vote.ProposedBlockInfo.Hash) == nil { | ||
| log.Debug("[VerifyVoteMessage] referenced header not present yet, defer verification", "blockNum", vote.ProposedBlockInfo.Number, "blockHash", vote.ProposedBlockInfo.Hash) | ||
| return false, nil | ||
| } |
Copilot
AI
Jan 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new header check successfully prevents spurious error logs, but this code path lacks test coverage. Consider adding a test case in vote_test.go that verifies the behavior when a vote arrives before its corresponding block header is available. The test should confirm that the function returns (false, nil) and logs at Debug level rather than Error level when the header is not found.
6a176e8 to
21a07e8
Compare
…inFinOrg#1850 Previously, vote verification would log errors and fail when the referenced block header was not yet available locally, especially when nodes in the same round processed votes before receiving the block header. This commit changes the logic to defer verification and log at debug level if the header is missing, preventing unnecessary error logs and aligning with upstream geth behavior for out-of-order message arrival during consensus voting.
Proposed changes
This PR eliminates the following errors which are produced by PR #1850:
Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅in the boxes that applyImpacted Components
Which part of the codebase this PR will touch base on,
Put an
✅in the boxes that applyChecklist
Put an
✅in the boxes once you have confirmed below actions (or provide reasons on not doing so) that