|
@ -163,7 +163,7 @@ func TestStateEnterProposeNoPrivValidator(t *testing.T) { |
|
|
startTestRound(ctx, cs, height, round) |
|
|
startTestRound(ctx, cs, height, round) |
|
|
|
|
|
|
|
|
// if we're not a validator, EnterPropose should timeout
|
|
|
// if we're not a validator, EnterPropose should timeout
|
|
|
ensureNewTimeout(t, timeoutCh, height, round, cs.config.TimeoutPropose.Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutCh, height, round, cs.state.ConsensusParams.Timeout.ProposeTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
if cs.GetRoundState().Proposal != nil { |
|
|
if cs.GetRoundState().Proposal != nil { |
|
|
t.Error("Expected to make no proposal, since no privValidator") |
|
|
t.Error("Expected to make no proposal, since no privValidator") |
|
@ -202,7 +202,7 @@ func TestStateEnterProposeYesPrivValidator(t *testing.T) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// if we're a validator, enterPropose should not timeout
|
|
|
// if we're a validator, enterPropose should not timeout
|
|
|
ensureNoNewTimeout(t, timeoutCh, cs.config.TimeoutPropose.Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNoNewTimeout(t, timeoutCh, cs.state.ConsensusParams.Timeout.ProposeTimeout(round).Nanoseconds()) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func TestStateBadProposal(t *testing.T) { |
|
|
func TestStateBadProposal(t *testing.T) { |
|
@ -313,7 +313,7 @@ func TestStateOversizedBlock(t *testing.T) { |
|
|
|
|
|
|
|
|
// c1 should log an error with the block part message as it exceeds the consensus params. The
|
|
|
// c1 should log an error with the block part message as it exceeds the consensus params. The
|
|
|
// block is not added to cs.ProposalBlock so the node timeouts.
|
|
|
// block is not added to cs.ProposalBlock so the node timeouts.
|
|
|
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.config.Propose(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.state.ConsensusParams.Timeout.ProposeTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
// and then should send nil prevote and precommit regardless of whether other validators prevote and
|
|
|
// and then should send nil prevote and precommit regardless of whether other validators prevote and
|
|
|
// precommit on it
|
|
|
// precommit on it
|
|
@ -481,7 +481,7 @@ func TestStateLock_NoPOL(t *testing.T) { |
|
|
|
|
|
|
|
|
// (note we're entering precommit for a second time this round)
|
|
|
// (note we're entering precommit for a second time this round)
|
|
|
// but with invalid args. then we enterPrecommitWait, and the timeout to new round
|
|
|
// but with invalid args. then we enterPrecommitWait, and the timeout to new round
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
///
|
|
|
///
|
|
|
|
|
|
|
|
@ -494,7 +494,7 @@ func TestStateLock_NoPOL(t *testing.T) { |
|
|
incrementRound(vs2) |
|
|
incrementRound(vs2) |
|
|
|
|
|
|
|
|
// now we're on a new round and not the proposer, so wait for timeout
|
|
|
// now we're on a new round and not the proposer, so wait for timeout
|
|
|
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.config.Propose(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.state.ConsensusParams.Timeout.ProposeTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
rs := cs1.GetRoundState() |
|
|
rs := cs1.GetRoundState() |
|
|
|
|
|
|
|
@ -513,7 +513,7 @@ func TestStateLock_NoPOL(t *testing.T) { |
|
|
|
|
|
|
|
|
// now we're going to enter prevote again, but with invalid args
|
|
|
// now we're going to enter prevote again, but with invalid args
|
|
|
// and then prevote wait, which should timeout. then wait for precommit
|
|
|
// and then prevote wait, which should timeout. then wait for precommit
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Prevote(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
// the proposed block should still be locked block.
|
|
|
// the proposed block should still be locked block.
|
|
|
// we should precommit nil and be locked on the proposal.
|
|
|
// we should precommit nil and be locked on the proposal.
|
|
|
ensurePrecommit(t, voteCh, height, round) |
|
|
ensurePrecommit(t, voteCh, height, round) |
|
@ -525,7 +525,7 @@ func TestStateLock_NoPOL(t *testing.T) { |
|
|
|
|
|
|
|
|
// (note we're entering precommit for a second time this round, but with invalid args
|
|
|
// (note we're entering precommit for a second time this round, but with invalid args
|
|
|
// then we enterPrecommitWait and timeout into NewRound
|
|
|
// then we enterPrecommitWait and timeout into NewRound
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
round++ // entering new round
|
|
|
round++ // entering new round
|
|
|
ensureNewRound(t, newRoundCh, height, round) |
|
|
ensureNewRound(t, newRoundCh, height, round) |
|
@ -552,7 +552,7 @@ func TestStateLock_NoPOL(t *testing.T) { |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), newBlockID, vs2) |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), newBlockID, vs2) |
|
|
ensurePrevote(t, voteCh, height, round) |
|
|
ensurePrevote(t, voteCh, height, round) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Prevote(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
ensurePrecommit(t, voteCh, height, round) // precommit
|
|
|
ensurePrecommit(t, voteCh, height, round) // precommit
|
|
|
|
|
|
|
|
|
validatePrecommit(ctx, t, cs1, round, 0, vss[0], nil, initialBlockID.Hash) // precommit nil but be locked on proposal
|
|
|
validatePrecommit(ctx, t, cs1, round, 0, vss[0], nil, initialBlockID.Hash) // precommit nil but be locked on proposal
|
|
@ -567,7 +567,7 @@ func TestStateLock_NoPOL(t *testing.T) { |
|
|
vs2) // NOTE: conflicting precommits at same height
|
|
|
vs2) // NOTE: conflicting precommits at same height
|
|
|
ensurePrecommit(t, voteCh, height, round) |
|
|
ensurePrecommit(t, voteCh, height, round) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
// cs1 is locked on a block at this point, so we must generate a new consensus
|
|
|
// cs1 is locked on a block at this point, so we must generate a new consensus
|
|
|
// state to force a new proposal block to be generated.
|
|
|
// state to force a new proposal block to be generated.
|
|
@ -606,7 +606,7 @@ func TestStateLock_NoPOL(t *testing.T) { |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), propBlockID, vs2) |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), propBlockID, vs2) |
|
|
ensurePrevote(t, voteCh, height, round) |
|
|
ensurePrevote(t, voteCh, height, round) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Prevote(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
ensurePrecommit(t, voteCh, height, round) |
|
|
ensurePrecommit(t, voteCh, height, round) |
|
|
validatePrecommit(ctx, t, cs1, round, 0, vss[0], nil, initialBlockID.Hash) // precommit nil but locked on proposal
|
|
|
validatePrecommit(ctx, t, cs1, round, 0, vss[0], nil, initialBlockID.Hash) // precommit nil but locked on proposal
|
|
|
|
|
|
|
|
@ -683,7 +683,7 @@ func TestStateLock_POLUpdateLock(t *testing.T) { |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
|
|
|
|
|
|
// timeout to new round.
|
|
|
// timeout to new round.
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
Round 1: |
|
|
Round 1: |
|
@ -789,7 +789,7 @@ func TestStateLock_POLRelock(t *testing.T) { |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
|
|
|
|
|
|
// timeout to new round.
|
|
|
// timeout to new round.
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
Round 1: |
|
|
Round 1: |
|
@ -884,7 +884,7 @@ func TestStateLock_PrevoteNilWhenLockedAndMissProposal(t *testing.T) { |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
|
|
|
|
|
|
// timeout to new round.
|
|
|
// timeout to new round.
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
Round 1: |
|
|
Round 1: |
|
@ -970,7 +970,7 @@ func TestStateLock_PrevoteNilWhenLockedAndDifferentProposal(t *testing.T) { |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
|
|
|
|
|
|
// timeout to new round.
|
|
|
// timeout to new round.
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
Round 1: |
|
|
Round 1: |
|
@ -1078,7 +1078,7 @@ func TestStateLock_POLDoesNotUnlock(t *testing.T) { |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vs3) |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vs3) |
|
|
|
|
|
|
|
|
// timeout to new round
|
|
|
// timeout to new round
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
Round 1: |
|
|
Round 1: |
|
@ -1112,7 +1112,7 @@ func TestStateLock_POLDoesNotUnlock(t *testing.T) { |
|
|
validatePrecommit(ctx, t, cs1, round, 0, vss[0], nil, blockID.Hash) |
|
|
validatePrecommit(ctx, t, cs1, round, 0, vss[0], nil, blockID.Hash) |
|
|
|
|
|
|
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
Round 2: |
|
|
Round 2: |
|
@ -1198,7 +1198,7 @@ func TestStateLock_MissingProposalWhenPOLSeenDoesNotUpdateLock(t *testing.T) { |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
|
|
|
|
|
|
// timeout to new round
|
|
|
// timeout to new round
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
Round 1: |
|
|
Round 1: |
|
@ -1285,7 +1285,7 @@ func TestStateLock_DoesNotLockOnOldProposal(t *testing.T) { |
|
|
incrementRound(vs2, vs3, vs4) |
|
|
incrementRound(vs2, vs3, vs4) |
|
|
|
|
|
|
|
|
// timeout to new round
|
|
|
// timeout to new round
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
Round 1: |
|
|
Round 1: |
|
@ -1356,7 +1356,7 @@ func TestStateLock_POLSafety1(t *testing.T) { |
|
|
|
|
|
|
|
|
// cs1 precommit nil
|
|
|
// cs1 precommit nil
|
|
|
ensurePrecommit(t, voteCh, height, round) |
|
|
ensurePrecommit(t, voteCh, height, round) |
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
incrementRound(vs2, vs3, vs4) |
|
|
incrementRound(vs2, vs3, vs4) |
|
|
round++ // moving to the next round
|
|
|
round++ // moving to the next round
|
|
@ -1397,7 +1397,7 @@ func TestStateLock_POLSafety1(t *testing.T) { |
|
|
|
|
|
|
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
incrementRound(vs2, vs3, vs4) |
|
|
incrementRound(vs2, vs3, vs4) |
|
|
round++ // moving to the next round
|
|
|
round++ // moving to the next round
|
|
@ -1409,7 +1409,7 @@ func TestStateLock_POLSafety1(t *testing.T) { |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
// timeout of propose
|
|
|
// timeout of propose
|
|
|
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.config.Propose(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.state.ConsensusParams.Timeout.ProposeTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
// finish prevote
|
|
|
// finish prevote
|
|
|
ensurePrevoteMatch(t, voteCh, height, round, nil) |
|
|
ensurePrevoteMatch(t, voteCh, height, round, nil) |
|
@ -1493,7 +1493,7 @@ func TestStateLock_POLSafety2(t *testing.T) { |
|
|
incrementRound(vs2, vs3, vs4) |
|
|
incrementRound(vs2, vs3, vs4) |
|
|
|
|
|
|
|
|
// timeout of precommit wait to new round
|
|
|
// timeout of precommit wait to new round
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
round++ // moving to the next round
|
|
|
round++ // moving to the next round
|
|
|
// in round 2 we see the polkad block from round 0
|
|
|
// in round 2 we see the polkad block from round 0
|
|
@ -1580,7 +1580,7 @@ func TestState_PrevotePOLFromPreviousRound(t *testing.T) { |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
|
|
|
|
|
|
// timeout to new round.
|
|
|
// timeout to new round.
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
Round 1: |
|
|
Round 1: |
|
@ -1621,7 +1621,7 @@ func TestState_PrevotePOLFromPreviousRound(t *testing.T) { |
|
|
ensurePrecommit(t, voteCh, height, round) |
|
|
ensurePrecommit(t, voteCh, height, round) |
|
|
|
|
|
|
|
|
// timeout to new round.
|
|
|
// timeout to new round.
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
Create a new proposal for D, the same block from Round 1. |
|
|
Create a new proposal for D, the same block from Round 1. |
|
@ -1714,7 +1714,7 @@ func TestProposeValidBlock(t *testing.T) { |
|
|
|
|
|
|
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
incrementRound(vs2, vs3, vs4) |
|
|
incrementRound(vs2, vs3, vs4) |
|
|
round++ // moving to the next round
|
|
|
round++ // moving to the next round
|
|
@ -1722,7 +1722,7 @@ func TestProposeValidBlock(t *testing.T) { |
|
|
ensureNewRound(t, newRoundCh, height, round) |
|
|
ensureNewRound(t, newRoundCh, height, round) |
|
|
|
|
|
|
|
|
// timeout of propose
|
|
|
// timeout of propose
|
|
|
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.config.Propose(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.state.ConsensusParams.Timeout.ProposeTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
// We did not see a valid proposal within this round, so prevote nil.
|
|
|
// We did not see a valid proposal within this round, so prevote nil.
|
|
|
ensurePrevoteMatch(t, voteCh, height, round, nil) |
|
|
ensurePrevoteMatch(t, voteCh, height, round, nil) |
|
@ -1743,7 +1743,7 @@ func TestProposeValidBlock(t *testing.T) { |
|
|
|
|
|
|
|
|
ensureNewRound(t, newRoundCh, height, round) |
|
|
ensureNewRound(t, newRoundCh, height, round) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
round++ // moving to the next round
|
|
|
round++ // moving to the next round
|
|
|
|
|
|
|
|
@ -1802,7 +1802,7 @@ func TestSetValidBlockOnDelayedPrevote(t *testing.T) { |
|
|
// vs3 send prevote nil
|
|
|
// vs3 send prevote nil
|
|
|
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), types.BlockID{}, vs3) |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), types.BlockID{}, vs3) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Prevote(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensurePrecommit(t, voteCh, height, round) |
|
|
ensurePrecommit(t, voteCh, height, round) |
|
|
// we should have precommitted
|
|
|
// we should have precommitted
|
|
@ -1856,7 +1856,7 @@ func TestSetValidBlockOnDelayedProposal(t *testing.T) { |
|
|
startTestRound(ctx, cs1, cs1.Height, round) |
|
|
startTestRound(ctx, cs1, cs1.Height, round) |
|
|
ensureNewRound(t, newRoundCh, height, round) |
|
|
ensureNewRound(t, newRoundCh, height, round) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.config.Propose(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.state.ConsensusParams.Timeout.ProposeTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensurePrevoteMatch(t, voteCh, height, round, nil) |
|
|
ensurePrevoteMatch(t, voteCh, height, round, nil) |
|
|
|
|
|
|
|
@ -1872,7 +1872,7 @@ func TestSetValidBlockOnDelayedProposal(t *testing.T) { |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vs2, vs3, vs4) |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vs2, vs3, vs4) |
|
|
ensureNewValidBlock(t, validBlockCh, height, round) |
|
|
ensureNewValidBlock(t, validBlockCh, height, round) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Prevote(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensurePrecommit(t, voteCh, height, round) |
|
|
ensurePrecommit(t, voteCh, height, round) |
|
|
validatePrecommit(ctx, t, cs1, round, -1, vss[0], nil, nil) |
|
|
validatePrecommit(ctx, t, cs1, round, -1, vss[0], nil, nil) |
|
@ -2036,7 +2036,7 @@ func TestWaitingTimeoutOnNilPolka(t *testing.T) { |
|
|
|
|
|
|
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
ensureNewRound(t, newRoundCh, height, round+1) |
|
|
ensureNewRound(t, newRoundCh, height, round+1) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -2074,7 +2074,7 @@ func TestWaitingTimeoutProposeOnNewRound(t *testing.T) { |
|
|
rs := cs1.GetRoundState() |
|
|
rs := cs1.GetRoundState() |
|
|
assert.True(t, rs.Step == cstypes.RoundStepPropose) // P0 does not prevote before timeoutPropose expires
|
|
|
assert.True(t, rs.Step == cstypes.RoundStepPropose) // P0 does not prevote before timeoutPropose expires
|
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Propose(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.ProposeTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensurePrevoteMatch(t, voteCh, height, round, nil) |
|
|
ensurePrevoteMatch(t, voteCh, height, round, nil) |
|
|
} |
|
|
} |
|
@ -2113,7 +2113,7 @@ func TestRoundSkipOnNilPolkaFromHigherRound(t *testing.T) { |
|
|
ensurePrecommit(t, voteCh, height, round) |
|
|
ensurePrecommit(t, voteCh, height, round) |
|
|
validatePrecommit(ctx, t, cs1, round, -1, vss[0], nil, nil) |
|
|
validatePrecommit(ctx, t, cs1, round, -1, vss[0], nil, nil) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
round++ // moving to the next round
|
|
|
round++ // moving to the next round
|
|
|
ensureNewRound(t, newRoundCh, height, round) |
|
|
ensureNewRound(t, newRoundCh, height, round) |
|
@ -2145,7 +2145,7 @@ func TestWaitTimeoutProposeOnNilPolkaForTheCurrentRound(t *testing.T) { |
|
|
incrementRound(vss[1:]...) |
|
|
incrementRound(vss[1:]...) |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.config.Propose(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.state.ConsensusParams.Timeout.ProposeTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensurePrevoteMatch(t, voteCh, height, round, nil) |
|
|
ensurePrevoteMatch(t, voteCh, height, round, nil) |
|
|
} |
|
|
} |
|
@ -2260,8 +2260,8 @@ func TestStartNextHeightCorrectlyAfterTimeout(t *testing.T) { |
|
|
ctx, cancel := context.WithCancel(context.Background()) |
|
|
ctx, cancel := context.WithCancel(context.Background()) |
|
|
defer cancel() |
|
|
defer cancel() |
|
|
|
|
|
|
|
|
config.Consensus.SkipTimeoutCommit = false |
|
|
|
|
|
cs1, vss := makeState(ctx, t, makeStateArgs{config: config}) |
|
|
cs1, vss := makeState(ctx, t, makeStateArgs{config: config}) |
|
|
|
|
|
cs1.state.ConsensusParams.Timeout.BypassCommitTimeout = false |
|
|
cs1.txNotifier = &fakeTxNotifier{ch: make(chan struct{})} |
|
|
cs1.txNotifier = &fakeTxNotifier{ch: make(chan struct{})} |
|
|
|
|
|
|
|
|
vs2, vs3, vs4 := vss[1], vss[2], vss[3] |
|
|
vs2, vs3, vs4 := vss[1], vss[2], vss[3] |
|
@ -2302,7 +2302,7 @@ func TestStartNextHeightCorrectlyAfterTimeout(t *testing.T) { |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vs3) |
|
|
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vs3) |
|
|
|
|
|
|
|
|
// wait till timeout occurs
|
|
|
// wait till timeout occurs
|
|
|
ensureNewTimeout(t, precommitTimeoutCh, height, round, cs1.config.TimeoutPrecommit.Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, precommitTimeoutCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewRound(t, newRoundCh, height, round+1) |
|
|
ensureNewRound(t, newRoundCh, height, round+1) |
|
|
|
|
|
|
|
@ -2313,7 +2313,7 @@ func TestStartNextHeightCorrectlyAfterTimeout(t *testing.T) { |
|
|
|
|
|
|
|
|
cs1.txNotifier.(*fakeTxNotifier).Notify() |
|
|
cs1.txNotifier.(*fakeTxNotifier).Notify() |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutProposeCh, height+1, round, cs1.config.Propose(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutProposeCh, height+1, round, cs1.state.ConsensusParams.Timeout.ProposeTimeout(round).Nanoseconds()) |
|
|
rs = cs1.GetRoundState() |
|
|
rs = cs1.GetRoundState() |
|
|
assert.False( |
|
|
assert.False( |
|
|
t, |
|
|
t, |
|
@ -2326,8 +2326,8 @@ func TestResetTimeoutPrecommitUponNewHeight(t *testing.T) { |
|
|
ctx, cancel := context.WithCancel(context.Background()) |
|
|
ctx, cancel := context.WithCancel(context.Background()) |
|
|
defer cancel() |
|
|
defer cancel() |
|
|
|
|
|
|
|
|
config.Consensus.SkipTimeoutCommit = false |
|
|
|
|
|
cs1, vss := makeState(ctx, t, makeStateArgs{config: config}) |
|
|
cs1, vss := makeState(ctx, t, makeStateArgs{config: config}) |
|
|
|
|
|
cs1.state.ConsensusParams.Timeout.BypassCommitTimeout = false |
|
|
|
|
|
|
|
|
vs2, vs3, vs4 := vss[1], vss[2], vss[3] |
|
|
vs2, vs3, vs4 := vss[1], vss[2], vss[3] |
|
|
height, round := cs1.Height, cs1.Round |
|
|
height, round := cs1.Height, cs1.Round |
|
@ -2441,7 +2441,7 @@ func TestStateHalt1(t *testing.T) { |
|
|
incrementRound(vs2, vs3, vs4) |
|
|
incrementRound(vs2, vs3, vs4) |
|
|
|
|
|
|
|
|
// timeout to new round
|
|
|
// timeout to new round
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds()) |
|
|
|
|
|
|
|
|
round++ // moving to the next round
|
|
|
round++ // moving to the next round
|
|
|
|
|
|
|
|
|