From 0db34a54e6b71fc2ad5b27a17e29dfbad184554f Mon Sep 17 00:00:00 2001 From: William Banfield Date: Fri, 15 Oct 2021 14:34:13 -0400 Subject: [PATCH] comment fixes from review --- internal/consensus/state.go | 4 +++- internal/consensus/state_test.go | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/consensus/state.go b/internal/consensus/state.go index a5d2cdce3..78f4e198f 100644 --- a/internal/consensus/state.go +++ b/internal/consensus/state.go @@ -1265,7 +1265,9 @@ func (cs *State) createProposalBlock() (block *types.Block, blockParts *types.Pa // Enter: `timeoutPropose` after entering Propose. // Enter: proposal block and POL is ready. -// If we received a valid proposal within this round that matches the block we are +// If we received a valid proposal within this round and we are not locked on a block, +// we will prevote for block. +// Otherwise, if we receive a valid proposal that matches the block we are // locked on or matches a block that received a POL in a round later than our // locked round, prevote for the proposal, otherwise vote nil. func (cs *State) enterPrevote(height int64, round int32) { diff --git a/internal/consensus/state_test.go b/internal/consensus/state_test.go index e9659d432..2916a6559 100644 --- a/internal/consensus/state_test.go +++ b/internal/consensus/state_test.go @@ -865,7 +865,6 @@ func TestStateLock_PrevoteNilWhenLockedAndMissProposal(t *testing.T) { /* Round 1: - Create a proposal for block B, the same block from round 1. Send a prevote for nil from each of the validators to cs1. Send a precommit for nil from all of the validtors to cs1. @@ -882,7 +881,7 @@ func TestStateLock_PrevoteNilWhenLockedAndMissProposal(t *testing.T) { ensurePrevote(t, voteCh, height, round) validatePrevote(t, cs1, round, vss[0], nil) - // Add prevotes from the remainder of the validators for the locked block. + // Add prevotes from the remainder of the validators nil. signAddVotes(config, cs1, tmproto.PrevoteType, nil, types.PartSetHeader{}, vs2, vs3, vs4) ensurePrecommit(t, voteCh, height, round) // We should now be locked on the same block but with an updated locked round. @@ -975,7 +974,7 @@ func TestStateLock_PrevoteNilWhenLockedAndDifferentProposal(t *testing.T) { ensurePrevote(t, voteCh, height, round) validatePrevote(t, cs1, round, vss[0], nil) - // Add prevotes from the remainder of the validators for the locked block. + // Add prevotes from the remainder of the validators for nil. signAddVotes(config, cs1, tmproto.PrevoteType, nil, types.PartSetHeader{}, vs2, vs3, vs4) // We should now be locked on the same block but prevote nil. @@ -1380,7 +1379,7 @@ func TestStateLock_POLSafety1(t *testing.T) { // finish prevote ensurePrevote(t, voteCh, height, round) - // we should prevote what we're locked on + // we should prevote for nil validatePrevote(t, cs1, round, vss[0], nil) newStepCh := subscribe(cs1.eventBus, types.EventQueryNewRoundStep)