From 57faa863ce9ac1d22b467030be3349d8d3b6430c Mon Sep 17 00:00:00 2001 From: Teddy Ding Date: Thu, 18 Jul 2024 18:05:57 -0400 Subject: [PATCH] Abort OE in PrepareProposal --- baseapp/abci.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/baseapp/abci.go b/baseapp/abci.go index 3d653e18875..3f85eadd1d2 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -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{