mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-20 22:26:15 +00:00
consensus: timeout params in toml used as overrides (#8186)
Replaces the set of timeout parameters in the config.toml file with unsafe-*override versions of the corresponding ConsensusParams.Timeout field. These fields can be used for the duration of v0.36 to override the consensus param in case of emergency. Adds a set to the ./internal/consensus/State type for correctly calculating the value of each timeout based on the set of overrides specified.
This commit is contained in:
@@ -787,9 +787,9 @@ func (cs *State) updateToState(ctx context.Context, state sm.State) {
|
||||
// to be gathered for the first block.
|
||||
// And alternative solution that relies on clocks:
|
||||
// cs.StartTime = state.LastBlockTime.Add(timeoutCommit)
|
||||
cs.StartTime = cs.state.ConsensusParams.Timeout.CommitTime(tmtime.Now())
|
||||
cs.StartTime = cs.commitTime(tmtime.Now())
|
||||
} else {
|
||||
cs.StartTime = cs.state.ConsensusParams.Timeout.CommitTime(cs.CommitTime)
|
||||
cs.StartTime = cs.commitTime(cs.CommitTime)
|
||||
}
|
||||
|
||||
cs.Validators = validators
|
||||
@@ -1262,7 +1262,7 @@ func (cs *State) enterPropose(ctx context.Context, height int64, round int32) {
|
||||
}()
|
||||
|
||||
// If we don't get the proposal and all block parts quick enough, enterPrevote
|
||||
cs.scheduleTimeout(cs.state.ConsensusParams.Timeout.ProposeTimeout(round), height, round, cstypes.RoundStepPropose)
|
||||
cs.scheduleTimeout(cs.proposeTimeout(round), height, round, cstypes.RoundStepPropose)
|
||||
|
||||
// Nothing more to do if we're not a validator
|
||||
if cs.privValidator == nil {
|
||||
@@ -1620,7 +1620,7 @@ func (cs *State) enterPrevoteWait(ctx context.Context, height int64, round int32
|
||||
}()
|
||||
|
||||
// Wait for some more prevotes; enterPrecommit
|
||||
cs.scheduleTimeout(cs.state.ConsensusParams.Timeout.VoteTimeout(round), height, round, cstypes.RoundStepPrevoteWait)
|
||||
cs.scheduleTimeout(cs.voteTimeout(round), height, round, cstypes.RoundStepPrevoteWait)
|
||||
}
|
||||
|
||||
// Enter: `timeoutPrevote` after any +2/3 prevotes.
|
||||
@@ -1773,7 +1773,7 @@ func (cs *State) enterPrecommitWait(ctx context.Context, height int64, round int
|
||||
}()
|
||||
|
||||
// wait for some more precommits; enterNewRound
|
||||
cs.scheduleTimeout(cs.state.ConsensusParams.Timeout.VoteTimeout(round), height, round, cstypes.RoundStepPrecommitWait)
|
||||
cs.scheduleTimeout(cs.voteTimeout(round), height, round, cstypes.RoundStepPrecommitWait)
|
||||
}
|
||||
|
||||
// Enter: +2/3 precommits for block
|
||||
@@ -2309,7 +2309,7 @@ func (cs *State) addVote(
|
||||
cs.evsw.FireEvent(ctx, types.EventVoteValue, vote)
|
||||
|
||||
// if we can skip timeoutCommit and have all the votes now,
|
||||
if cs.state.ConsensusParams.Timeout.BypassCommitTimeout && cs.LastCommit.HasAll() {
|
||||
if cs.bypassCommitTimeout() && cs.LastCommit.HasAll() {
|
||||
// go straight to new round (skip timeout commit)
|
||||
// cs.scheduleTimeout(time.Duration(0), cs.Height, 0, cstypes.RoundStepNewHeight)
|
||||
cs.enterNewRound(ctx, cs.Height, 0)
|
||||
@@ -2422,7 +2422,7 @@ func (cs *State) addVote(
|
||||
|
||||
if !blockID.IsNil() {
|
||||
cs.enterCommit(ctx, height, vote.Round)
|
||||
if cs.state.ConsensusParams.Timeout.BypassCommitTimeout && precommits.HasAll() {
|
||||
if cs.bypassCommitTimeout() && precommits.HasAll() {
|
||||
cs.enterNewRound(ctx, cs.Height, 0)
|
||||
}
|
||||
} else {
|
||||
@@ -2472,7 +2472,7 @@ func (cs *State) signVote(
|
||||
|
||||
// If the signedMessageType is for precommit,
|
||||
// use our local precommit Timeout as the max wait time for getting a singed commit. The same goes for prevote.
|
||||
timeout := cs.state.ConsensusParams.Timeout.VoteTimeout(cs.Round)
|
||||
timeout := cs.voteTimeout(cs.Round)
|
||||
|
||||
switch msgType {
|
||||
case tmproto.PrecommitType:
|
||||
@@ -2540,7 +2540,7 @@ func (cs *State) updatePrivValidatorPubKey(rctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
timeout := cs.state.ConsensusParams.Timeout.VoteTimeout(cs.Round)
|
||||
timeout := cs.voteTimeout(cs.Round)
|
||||
|
||||
// no GetPubKey retry beyond the proposal/voting in RetrySignerClient
|
||||
if cs.Step >= cstypes.RoundStepPrecommit && cs.privValidatorType == types.RetrySignerClient {
|
||||
@@ -2666,6 +2666,49 @@ func repairWalFile(src, dst string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cs *State) proposeTimeout(round int32) time.Duration {
|
||||
p := cs.state.ConsensusParams.Timeout.Propose
|
||||
if cs.config.UnsafeProposeTimeoutOverride != 0 {
|
||||
p = cs.config.UnsafeProposeTimeoutOverride
|
||||
}
|
||||
pd := cs.state.ConsensusParams.Timeout.ProposeDelta
|
||||
if cs.config.UnsafeProposeTimeoutDeltaOverride != 0 {
|
||||
pd = cs.config.UnsafeProposeTimeoutDeltaOverride
|
||||
}
|
||||
return time.Duration(
|
||||
p.Nanoseconds()+pd.Nanoseconds()*int64(round),
|
||||
) * time.Nanosecond
|
||||
}
|
||||
|
||||
func (cs *State) voteTimeout(round int32) time.Duration {
|
||||
v := cs.state.ConsensusParams.Timeout.Vote
|
||||
if cs.config.UnsafeVoteTimeoutOverride != 0 {
|
||||
v = cs.config.UnsafeVoteTimeoutOverride
|
||||
}
|
||||
vd := cs.state.ConsensusParams.Timeout.VoteDelta
|
||||
if cs.config.UnsafeVoteTimeoutDeltaOverride != 0 {
|
||||
vd = cs.config.UnsafeVoteTimeoutDeltaOverride
|
||||
}
|
||||
return time.Duration(
|
||||
v.Nanoseconds()+vd.Nanoseconds()*int64(round),
|
||||
) * time.Nanosecond
|
||||
}
|
||||
|
||||
func (cs *State) commitTime(t time.Time) time.Time {
|
||||
c := cs.state.ConsensusParams.Timeout.Commit
|
||||
if cs.config.UnsafeCommitTimeoutOverride != 0 {
|
||||
c = cs.config.UnsafeProposeTimeoutOverride
|
||||
}
|
||||
return t.Add(c)
|
||||
}
|
||||
|
||||
func (cs *State) bypassCommitTimeout() bool {
|
||||
if cs.config.UnsafeBypassCommitTimeoutOverride != nil {
|
||||
return *cs.config.UnsafeBypassCommitTimeoutOverride
|
||||
}
|
||||
return cs.state.ConsensusParams.Timeout.BypassCommitTimeout
|
||||
}
|
||||
|
||||
func (cs *State) calculateProposalTimestampDifferenceMetric() {
|
||||
if cs.Proposal != nil && cs.Proposal.POLRound == -1 {
|
||||
tp := types.SynchronyParams{
|
||||
|
||||
@@ -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
|
||||
// block is not added to cs.ProposalBlock so the node timeouts.
|
||||
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.state.ConsensusParams.Timeout.ProposeTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.proposeTimeout(round).Nanoseconds())
|
||||
|
||||
// and then should send nil prevote and precommit regardless of whether other validators prevote and
|
||||
// precommit on it
|
||||
@@ -481,7 +481,7 @@ func TestStateLock_NoPOL(t *testing.T) {
|
||||
|
||||
// (note we're entering precommit for a second time this round)
|
||||
// but with invalid args. then we enterPrecommitWait, and the timeout to new round
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
///
|
||||
|
||||
@@ -494,7 +494,7 @@ func TestStateLock_NoPOL(t *testing.T) {
|
||||
incrementRound(vs2)
|
||||
|
||||
// now we're on a new round and not the proposer, so wait for timeout
|
||||
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.state.ConsensusParams.Timeout.ProposeTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.proposeTimeout(round).Nanoseconds())
|
||||
|
||||
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
|
||||
// and then prevote wait, which should timeout. then wait for precommit
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
// the proposed block should still be locked block.
|
||||
// we should precommit nil and be locked on the proposal.
|
||||
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
|
||||
// then we enterPrecommitWait and timeout into NewRound
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
round++ // entering new 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)
|
||||
ensurePrevote(t, voteCh, height, round)
|
||||
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
ensurePrecommit(t, voteCh, height, round) // precommit
|
||||
|
||||
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
|
||||
ensurePrecommit(t, voteCh, height, round)
|
||||
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
// 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.
|
||||
@@ -606,7 +606,7 @@ func TestStateLock_NoPOL(t *testing.T) {
|
||||
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), propBlockID, vs2)
|
||||
ensurePrevote(t, voteCh, height, round)
|
||||
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
ensurePrecommit(t, voteCh, height, round)
|
||||
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)
|
||||
|
||||
// timeout to new round.
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
/*
|
||||
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)
|
||||
|
||||
// timeout to new round.
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
/*
|
||||
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)
|
||||
|
||||
// timeout to new round.
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
/*
|
||||
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)
|
||||
|
||||
// timeout to new round.
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
/*
|
||||
Round 1:
|
||||
@@ -1078,7 +1078,7 @@ func TestStateLock_POLDoesNotUnlock(t *testing.T) {
|
||||
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vs3)
|
||||
|
||||
// timeout to new round
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
/*
|
||||
Round 1:
|
||||
@@ -1112,7 +1112,7 @@ func TestStateLock_POLDoesNotUnlock(t *testing.T) {
|
||||
validatePrecommit(ctx, t, cs1, round, 0, vss[0], nil, blockID.Hash)
|
||||
|
||||
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
/*
|
||||
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)
|
||||
|
||||
// timeout to new round
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
/*
|
||||
Round 1:
|
||||
@@ -1285,7 +1285,7 @@ func TestStateLock_DoesNotLockOnOldProposal(t *testing.T) {
|
||||
incrementRound(vs2, vs3, vs4)
|
||||
|
||||
// timeout to new round
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
/*
|
||||
Round 1:
|
||||
@@ -1356,7 +1356,7 @@ func TestStateLock_POLSafety1(t *testing.T) {
|
||||
|
||||
// cs1 precommit nil
|
||||
ensurePrecommit(t, voteCh, height, round)
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
incrementRound(vs2, vs3, vs4)
|
||||
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)
|
||||
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
incrementRound(vs2, vs3, vs4)
|
||||
round++ // moving to the next round
|
||||
@@ -1409,7 +1409,7 @@ func TestStateLock_POLSafety1(t *testing.T) {
|
||||
*/
|
||||
|
||||
// timeout of propose
|
||||
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.state.ConsensusParams.Timeout.ProposeTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.proposeTimeout(round).Nanoseconds())
|
||||
|
||||
// finish prevote
|
||||
ensurePrevoteMatch(t, voteCh, height, round, nil)
|
||||
@@ -1493,7 +1493,7 @@ func TestStateLock_POLSafety2(t *testing.T) {
|
||||
incrementRound(vs2, vs3, vs4)
|
||||
|
||||
// timeout of precommit wait to new round
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
round++ // moving to the next round
|
||||
// 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)
|
||||
|
||||
// timeout to new round.
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
/*
|
||||
Round 1:
|
||||
@@ -1621,7 +1621,7 @@ func TestState_PrevotePOLFromPreviousRound(t *testing.T) {
|
||||
ensurePrecommit(t, voteCh, height, round)
|
||||
|
||||
// timeout to new round.
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
/*
|
||||
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)
|
||||
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
incrementRound(vs2, vs3, vs4)
|
||||
round++ // moving to the next round
|
||||
@@ -1722,7 +1722,7 @@ func TestProposeValidBlock(t *testing.T) {
|
||||
ensureNewRound(t, newRoundCh, height, round)
|
||||
|
||||
// timeout of propose
|
||||
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.state.ConsensusParams.Timeout.ProposeTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.proposeTimeout(round).Nanoseconds())
|
||||
|
||||
// We did not see a valid proposal within this round, so prevote nil.
|
||||
ensurePrevoteMatch(t, voteCh, height, round, nil)
|
||||
@@ -1743,7 +1743,7 @@ func TestProposeValidBlock(t *testing.T) {
|
||||
|
||||
ensureNewRound(t, newRoundCh, height, round)
|
||||
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
round++ // moving to the next round
|
||||
|
||||
@@ -1802,7 +1802,7 @@ func TestSetValidBlockOnDelayedPrevote(t *testing.T) {
|
||||
// vs3 send prevote nil
|
||||
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), types.BlockID{}, vs3)
|
||||
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
ensurePrecommit(t, voteCh, height, round)
|
||||
// we should have precommitted
|
||||
@@ -1856,7 +1856,7 @@ func TestSetValidBlockOnDelayedProposal(t *testing.T) {
|
||||
startTestRound(ctx, cs1, cs1.Height, round)
|
||||
ensureNewRound(t, newRoundCh, height, round)
|
||||
|
||||
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.state.ConsensusParams.Timeout.ProposeTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.proposeTimeout(round).Nanoseconds())
|
||||
|
||||
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)
|
||||
ensureNewValidBlock(t, validBlockCh, height, round)
|
||||
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
ensurePrecommit(t, voteCh, height, round)
|
||||
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)
|
||||
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
ensureNewRound(t, newRoundCh, height, round+1)
|
||||
}
|
||||
|
||||
@@ -2074,7 +2074,7 @@ func TestWaitingTimeoutProposeOnNewRound(t *testing.T) {
|
||||
rs := cs1.GetRoundState()
|
||||
assert.True(t, rs.Step == cstypes.RoundStepPropose) // P0 does not prevote before timeoutPropose expires
|
||||
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.ProposeTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.proposeTimeout(round).Nanoseconds())
|
||||
|
||||
ensurePrevoteMatch(t, voteCh, height, round, nil)
|
||||
}
|
||||
@@ -2113,7 +2113,7 @@ func TestRoundSkipOnNilPolkaFromHigherRound(t *testing.T) {
|
||||
ensurePrecommit(t, voteCh, height, round)
|
||||
validatePrecommit(ctx, t, cs1, round, -1, vss[0], nil, nil)
|
||||
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
round++ // moving to the next round
|
||||
ensureNewRound(t, newRoundCh, height, round)
|
||||
@@ -2145,7 +2145,7 @@ func TestWaitTimeoutProposeOnNilPolkaForTheCurrentRound(t *testing.T) {
|
||||
incrementRound(vss[1:]...)
|
||||
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
|
||||
|
||||
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.state.ConsensusParams.Timeout.ProposeTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.proposeTimeout(round).Nanoseconds())
|
||||
|
||||
ensurePrevoteMatch(t, voteCh, height, round, nil)
|
||||
}
|
||||
@@ -2302,7 +2302,7 @@ func TestStartNextHeightCorrectlyAfterTimeout(t *testing.T) {
|
||||
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vs3)
|
||||
|
||||
// wait till timeout occurs
|
||||
ensureNewTimeout(t, precommitTimeoutCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, precommitTimeoutCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
ensureNewRound(t, newRoundCh, height, round+1)
|
||||
|
||||
@@ -2313,7 +2313,7 @@ func TestStartNextHeightCorrectlyAfterTimeout(t *testing.T) {
|
||||
|
||||
cs1.txNotifier.(*fakeTxNotifier).Notify()
|
||||
|
||||
ensureNewTimeout(t, timeoutProposeCh, height+1, round, cs1.state.ConsensusParams.Timeout.ProposeTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutProposeCh, height+1, round, cs1.proposeTimeout(round).Nanoseconds())
|
||||
rs = cs1.GetRoundState()
|
||||
assert.False(
|
||||
t,
|
||||
@@ -2441,7 +2441,7 @@ func TestStateHalt1(t *testing.T) {
|
||||
incrementRound(vs2, vs3, vs4)
|
||||
|
||||
// timeout to new round
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.state.ConsensusParams.Timeout.VoteTimeout(round).Nanoseconds())
|
||||
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
|
||||
|
||||
round++ // moving to the next round
|
||||
|
||||
|
||||
Reference in New Issue
Block a user