From 9b29adb7cfc0b501fcd5da46733cca484a580329 Mon Sep 17 00:00:00 2001 From: William Banfield Date: Fri, 15 Oct 2021 16:20:17 -0400 Subject: [PATCH] remove legacy triggered precommit logic --- internal/consensus/state.go | 10 +++------- internal/consensus/types/round_state.go | 11 +++++------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/internal/consensus/state.go b/internal/consensus/state.go index 42900a7d4..16260ba0a 100644 --- a/internal/consensus/state.go +++ b/internal/consensus/state.go @@ -726,7 +726,6 @@ func (cs *State) updateToState(state sm.State) { cs.Votes = cstypes.NewHeightVoteSet(state.ChainID, height, validators) cs.CommitRound = -1 cs.LastValidators = state.LastValidators - cs.TriggeredTimeoutPrecommit = false cs.state = state @@ -1052,7 +1051,6 @@ func (cs *State) enterNewRound(height int64, round int32) { } cs.Votes.SetRound(tmmath.SafeAddInt32(round, 1)) // also track next round (round+1) to allow round-skipping - cs.TriggeredTimeoutPrecommit = false if err := cs.eventBus.PublishEventNewRound(cs.NewRoundEvent()); err != nil { cs.Logger.Error("failed publishing new round", "err", err) @@ -1491,12 +1489,10 @@ func (cs *State) enterPrecommit(height int64, round int32) { // Enter: any +2/3 precommits for next round. func (cs *State) enterPrecommitWait(height int64, round int32) { logger := cs.Logger.With("height", height, "round", round) - - if cs.Height != height || round < cs.Round || (cs.Round == round && cs.TriggeredTimeoutPrecommit) { + if cs.Height != height || round < cs.Round || (cs.Round == round && cstypes.RoundStepPrecommitWait <= cs.Step) { logger.Debug( "entering precommit wait step with invalid args", - "triggered_timeout", cs.TriggeredTimeoutPrecommit, - "current", fmt.Sprintf("%v/%v", cs.Height, cs.Round), + "current", fmt.Sprintf("%v/%v/%v", cs.Height, cs.Round, cs.Step), ) return } @@ -1512,7 +1508,7 @@ func (cs *State) enterPrecommitWait(height int64, round int32) { defer func() { // Done enterPrecommitWait: - cs.TriggeredTimeoutPrecommit = true + cs.updateRoundStep(round, cstypes.RoundStepPrecommitWait) cs.newStep() }() diff --git a/internal/consensus/types/round_state.go b/internal/consensus/types/round_state.go index 9e67b76c0..d1c6544b4 100644 --- a/internal/consensus/types/round_state.go +++ b/internal/consensus/types/round_state.go @@ -85,12 +85,11 @@ type RoundState struct { ValidBlock *types.Block `json:"valid_block"` // Last known block of POL mentioned above. // Last known block parts of POL mentioned above. - ValidBlockParts *types.PartSet `json:"valid_block_parts"` - Votes *HeightVoteSet `json:"votes"` - CommitRound int32 `json:"commit_round"` // - LastCommit *types.VoteSet `json:"last_commit"` // Last precommits at Height-1 - LastValidators *types.ValidatorSet `json:"last_validators"` - TriggeredTimeoutPrecommit bool `json:"triggered_timeout_precommit"` + ValidBlockParts *types.PartSet `json:"valid_block_parts"` + Votes *HeightVoteSet `json:"votes"` + CommitRound int32 `json:"commit_round"` // + LastCommit *types.VoteSet `json:"last_commit"` // Last precommits at Height-1 + LastValidators *types.ValidatorSet `json:"last_validators"` } // Compressed version of the RoundState for use in RPC