From 6508069ad33ef21c90db50fff944e50fb702ec18 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Fri, 26 Jul 2024 18:03:11 +0200 Subject: [PATCH] fix(consensus): proposal not generated after waiting for last block time to pass --- internal/consensus/state.go | 4 ++-- internal/consensus/ticker.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/consensus/state.go b/internal/consensus/state.go index d3faa21491..2e54f5a174 100644 --- a/internal/consensus/state.go +++ b/internal/consensus/state.go @@ -746,7 +746,7 @@ func (cs *State) handleTimeout( // XXX: should we fire timeout here (for timeout commit)? _ = cs.ctrl.Dispatch(ctx, &EnterNewRoundEvent{Height: ti.Height}, stateData) case cstypes.RoundStepNewRound: - _ = cs.ctrl.Dispatch(ctx, &EnterProposeEvent{Height: ti.Height}, stateData) + _ = cs.ctrl.Dispatch(ctx, &EnterProposeEvent{Height: ti.Height, Round: ti.Round}, stateData) case cstypes.RoundStepPropose: if err := cs.eventBus.PublishEventTimeoutPropose(stateData.RoundStateEvent()); err != nil { cs.logger.Error("failed publishing timeout propose", "err", err) @@ -788,7 +788,7 @@ func (cs *State) handleTxsAvailable(ctx context.Context, stateData *StateData) { cs.roundScheduler.ScheduleTimeout(timeoutCommit, stateData.Height, 0, cstypes.RoundStepNewRound) case cstypes.RoundStepNewRound: // after timeoutCommit - _ = cs.ctrl.Dispatch(ctx, &EnterProposeEvent{Height: stateData.Height}, stateData) + _ = cs.ctrl.Dispatch(ctx, &EnterProposeEvent{Height: stateData.Height, Round: stateData.Round}, stateData) } } diff --git a/internal/consensus/ticker.go b/internal/consensus/ticker.go index a768854c6f..30b94d3adb 100644 --- a/internal/consensus/ticker.go +++ b/internal/consensus/ticker.go @@ -115,9 +115,9 @@ func (t *timeoutTicker) timeoutRoutine(ctx context.Context) { // NOTE time.Timer allows duration to be non-positive ti = newti t.timer.Reset(ti.Duration) - t.logger.Trace("Internal state machine timeout scheduled", "duration", ti.Duration, "height", ti.Height, "round", ti.Round, "step", ti.Step.String()) + t.logger.Trace("Internal state machine timeout scheduled", "duration", ti.Duration.String(), "height", ti.Height, "round", ti.Round, "step", ti.Step.String()) case <-t.timer.C: - t.logger.Debug("Internal state machine timeout elapsed", "duration", ti.Duration, "height", ti.Height, "round", ti.Round, "step", ti.Step.String()) + t.logger.Debug("Internal state machine timeout elapsed", "duration", ti.Duration.String(), "height", ti.Height, "round", ti.Round, "step", ti.Step.String()) // go routine here guarantees timeoutRoutine doesn't block. // Determinism comes from playback in the receiveRoutine. // We can eliminate it by merging the timeoutRoutine into receiveRoutine