feat(baseapp): Abort OE in PrepareProposal (Upstream dydx) (backport #22287) (#22303)

Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
mergify[bot] 2024-10-17 15:16:55 +02:00 committed by GitHub
parent ce839cc81b
commit 15bd96f57d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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{