diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 22ed0abd881a..8a987156cb79 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -724,8 +724,12 @@ func (app *BaseApp) runTx(mode runTxMode, txBytes []byte) (gInfo sdk.GasInfo, re // // Note: If the postHandler fails, we also revert the runMsgs state. if app.postHandler != nil { - // Follow-up Ref: https://github.com/cosmos/cosmos-sdk/pull/13941 - newCtx, err := app.postHandler(runMsgCtx, tx, mode == runTxModeSimulate, err == nil) + // The runMsgCtx context currently contains events emitted by the ante handler. + // We clear this to correctly order events without duplicates. + // Note that the state is still preserved. + postCtx := runMsgCtx.WithEventManager(sdk.NewEventManager()) + + newCtx, err := app.postHandler(postCtx, tx, mode == runTxModeSimulate, err == nil) if err != nil { return gInfo, nil, anteEvents, priority, err }