Skip to content

consensus: proposal#POLRound checking code might be incorrect #2702

@melekes

Description

@melekes

tendermint/consensus/state.go

Lines 1428 to 1432 in bbf15b3

// Verify POLRound, which must be -1 or between 0 and proposal.Round exclusive.
if proposal.POLRound != -1 &&
(proposal.POLRound < 0 || proposal.Round <= proposal.POLRound) {
return ErrInvalidProposalPOLRound
}

Refs #2392 (comment)
In log-node2.txt I found

Okt 01 15:50:24 ip-172-31-9-150.us-east-2.compute.internal thorchaind[20170]: E[10-01|15:50:24.490] Error with msg                               module=consensus height=366511 round=0 type=*consensus.ProposalMessage peer= err="Error invalid proposal POL round" msg="[Proposal Proposal{366511/0 1:707EC619D399 (0,:0:000000000000) /EA1BAEEF4B7D.../ @ 2018-10-01T15:50:24.485Z}]"

Can'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:

	if !(proposal.POLRound == -1 ||
		(proposal.POLRound > 0 && proposal.POLRound < proposal.Round)) {
		return ErrInvalidProposalPOLRound
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions