Skip to content

Conversation

@gzliudan
Copy link
Collaborator

Proposed changes

This PR eliminates the following errors which are produced by PR #1850:

ERROR[12-23|23:05:41.035] [VerifyVoteMessage] Fail to get epochInfo when verifying vote message! blockNum=76,854,127 blockHash=147610..416730 voteHash=4d0a5c..9e7fcf voteGapNumber=76,852,350 err="[getEpochSwitchInfo] can not find header from db hash 0x147610f021c9b4b5fda55239a807181c52c864a3b25d02ba0b9785105a416730"
ERROR[12-23|23:05:41.035] [Vote] Verify BFT Vote                   error="[getEpochSwitchInfo] can not find header from db hash 0x147610f021c9b4b5fda55239a807181c52c864a3b25d02ba0b9785105a416730"

ERROR[12-23|23:05:43.380] [VerifyVoteMessage] Fail to get epochInfo when verifying vote message! blockNum=76,854,128 blockHash=6eaf17..9feb10 voteHash=54c559..dafbde voteGapNumber=76,852,350 err="[getEpochSwitchInfo] can not find header from db hash 0x6eaf1777cab5f487090909afd5eabf15dd103413a833a305b1b8970d349feb10"
ERROR[12-23|23:05:43.380] [Vote] Verify BFT Vote                   error="[getEpochSwitchInfo] can not find header from db hash 0x6eaf1777cab5f487090909afd5eabf15dd103413a833a305b1b8970d349feb10"

Types of changes

What types of changes does your code introduce to XDC network?
Put an in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)
  • Regular KTLO or any of the maintaince work. e.g code style
  • CICD Improvement

Impacted Components

Which part of the codebase this PR will touch base on,

Put an in the boxes that apply

  • Consensus
  • Account
  • Network
  • Geth
  • Smart Contract
  • External components
  • Not sure (Please specify below)

Checklist

Put an in the boxes once you have confirmed below actions (or provide reasons on not doing so) that

  • This PR has sufficient test coverage (unit/integration test) OR I have provided reason in the PR description for not having test coverage
  • Provide an end-to-end test plan in the PR description on how to manually test it on the devnet/testnet.
  • Tested the backwards compatibility.
  • Tested with XDC nodes running this version co-exist with those running the previous version.
  • Relevant documentation has been updated as part of this PR
  • N/A

@coderabbitai
Copy link

coderabbitai bot commented Dec 23, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gzliudan gzliudan force-pushed the fix-pr-1850 branch 2 times, most recently from 7f63d42 to 6a176e8 Compare December 25, 2025 05:10
@gzliudan gzliudan requested a review from anunay-xin December 27, 2025 08:44
Copy link

Copilot AI left a 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.

Comment on lines +28 to +31
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
}
Copy link

Copilot AI Jan 4, 2026

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.

Copilot uses AI. Check for mistakes.
@gzliudan gzliudan force-pushed the fix-pr-1850 branch 6 times, most recently from 6a176e8 to 21a07e8 Compare January 4, 2026 05:52
…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.
@AnilChinchawale AnilChinchawale merged commit 84ac794 into XinFinOrg:dev-upgrade Jan 5, 2026
13 checks passed
@gzliudan gzliudan deleted the fix-pr-1850 branch January 5, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants