Skip to content

consensus: wrong round number when handling RoundStepNewRound timeout #9229

@fatcat22

Description

@fatcat22

Tendermint version: d0c3457

What happened:
When handling timeout type RoundStepNewRound located at internal/consensus/state.go, the code calling enterPropose with round 0 all the time:

func (cs *State) handleTimeout(
	ctx context.Context,
	ti timeoutInfo,
	rs cstypes.RoundState,
) {
    /// hiden code ......
	case cstypes.RoundStepNewRound:
		cs.enterPropose(ctx, ti.Height, 0)
}

And there are two places to setup this kind of timeout, one is located at State.enterNewRound:

func (cs *State) enterNewRound(ctx context.Context, height int64, round int32) {
    /// hiden code ......
	if waitForTxs {
		if cs.config.CreateEmptyBlocksInterval > 0 {
			cs.scheduleTimeout(cs.config.CreateEmptyBlocksInterval, height, round,
				cstypes.RoundStepNewRound)
		}
		return
	}
}

and another is located at State.enterPropose:

func (cs *State) enterPropose(ctx context.Context, height int64, round int32) {
    /// hiden code
		if proposerWaitTime > 0 {
			cs.scheduleTimeout(proposerWaitTime, height, round, cstypes.RoundStepNewRound)
			return
		}
}
}

which are all not necessary to be round 0 with round variable equal 0.

What you expected to happen:
enterPropose should be called with ti.Round:

	case cstypes.RoundStepNewRound:
		cs.enterPropose(ctx, ti.Height, ti.Round)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions