-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
consensus: proposal#POLRound checking code might be incorrect #2702
Comments
This condition is really hard to get. Initially, lockedRound and validRound are set to -1 as we start with round 0. If some process locks a block in round 0, then 0 is valid proposal.POLRound in rounds > 0. I would suggest small modifications to your proposal: if !(proposal.POLRound < -1 ||
(proposal.POLRound >= 0 && proposal.POLRound >= proposal.Round)) {
return ErrInvalidProposalPOLRound
} |
…LRound in rounds > 0 This condition is really hard to get. Initially, lockedRound and validRound are set to -1 as we start with round 0. Refs #2702
Note here
proposal.Round (0) == proposal.POLRound (0) |
if !(proposal.POLRound < -1 ||
(proposal.POLRound >= 0 && proposal.POLRound >= proposal.Round)) {
return ErrInvalidProposalPOLRound
} This doesn't look right - wouldn't this return an error if POLRound == -1 ? I think perhaps what's happening is that the proposer is receiving +2/3 prevotes for nil for the round before they even get a chance to make a proposal. So then POLInfo returns a 0 for POLRound since it's seen a +2/3 prevotes |
@ebuchman You are right, it returns error for POLRound == -1; the original condition is correct. Regarding your other comment, it will not be a concern after we modify Proposal to use ValidRound instead of computing POLInfo (#2646). if (proposal.POLRound < 0 && proposal.POLRound != -1) || proposal.POLRound >= proposal.Round {
return ErrInvalidProposalPOLRound
} |
Let's close this for #2646 |
tendermint/consensus/state.go
Lines 1428 to 1432 in bbf15b3
Refs #2392 (comment)
In
log-node2.txt
I foundCan't
POLRound
be 0? If not, what could've led the honest node to create such a proposal?In any case, I'd prefer the above code to be rewritten:
The text was updated successfully, but these errors were encountered: