Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(consensus): PrepareProposal should not be called during replay #678

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/consensus/state_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func NewController(cs *State, wal *wrapWAL, statsQueue *chanQueue[msgInfo], prop
scheduler: cs.roundScheduler,
eventPublisher: cs.eventPublisher,
proposalCreator: propler,
replayMode: cs.replayMode,
},
AddProposalBlockPartType: &AddProposalBlockPartAction{
logger: cs.logger,
Expand Down
7 changes: 7 additions & 0 deletions internal/consensus/state_enter_propose.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type EnterProposeAction struct {
scheduler *roundScheduler
eventPublisher *EventPublisher
proposalCreator cstypes.ProposalCreator
replayMode bool
}

func (c *EnterProposeAction) Execute(ctx context.Context, stateEvent StateEvent) error {
Expand Down Expand Up @@ -93,6 +94,12 @@ func (c *EnterProposeAction) Execute(ctx context.Context, stateEvent StateEvent)
"node_proTxHash", proTxHash.String())
return nil
}
// In replay mode, we don't propose blocks.
if c.replayMode {
logger.Debug("enter propose step; our turn to propose but in replay mode, not proposing")
return nil
}

logger.Debug("propose step; our turn to propose",
"proposer_proTxHash", proTxHash.ShortString(),
)
Expand Down
2 changes: 1 addition & 1 deletion internal/consensus/types/round_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ type RoundState struct {
// Last known round with POL for non-nil valid block.
ValidRound int32 `json:"valid_round"`
ValidBlock *types.Block `json:"valid_block"` // Last known block of POL mentioned above.
ValidBlockRecvTime time.Time `json:"valid_block_time"` // Receive time of ast known block of POL mentioned above.
ValidBlockRecvTime time.Time `json:"valid_block_time"` // Receive time of last known block of POL mentioned above.

// Last known block parts of POL mentioned above.
ValidBlockParts *types.PartSet `json:"valid_block_parts"`
Expand Down