Skip to content

Commit

Permalink
feat(baseapp): Abort OE in PrepareProposal (Upstream dydx) (backport #…
Browse files Browse the repository at this point in the history
…22287) (#22303)

Co-authored-by: Julien Robert <[email protected]>
  • Loading branch information
mergify[bot] and julienrbrt authored Oct 17, 2024
1 parent ce839cc commit 15bd96f
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 @@ -409,6 +409,14 @@ func (app *BaseApp) PrepareProposal(req *abci.PrepareProposalRequest) (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 15bd96f

Please sign in to comment.