Skip to content

Commit

Permalink
Abort OE in PrepareProposal
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyding committed Jul 18, 2024
1 parent 649319c commit 57faa86
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,14 @@ func (app *BaseApp) PrepareProposal(req *abci.RequestPrepareProposal) (resp *abc
return nil, errors.New("PrepareProposal handler not set")
}

// Abort any running OE so it cannot overlap with `PrepareProposal`. This could happen if optimistic
// `internalFinalizeBlock` from previous round takes a long time, but consensus has moved on to next round.
// Overlap is undesirable, since `internalFinalizeBlock` and `PrepareProoposal` could share access to
// in-memory structs depending on application implementation.
// No-op if OE is not enabled.
// Similar call to Abort() is done in `ProcessProposal`.
app.optimisticExec.Abort()

// Always reset state given that PrepareProposal can timeout and be called
// again in a subsequent round.
header := cmtproto.Header{
Expand Down

0 comments on commit 57faa86

Please sign in to comment.