diff --git a/CHANGELOG.md b/CHANGELOG.md index 979d44aee34e..5e4c89dd9e57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +* (baseapp) [#13983](https://github.com/cosmos/cosmos-sdk/pull/13983) Don't emit duplicate ante-handler events when a post-handler is defined. * (x/staking) [#14064](https://github.com/cosmos/cosmos-sdk/pull/14064) Set all fields in `redelegation.String()`. * (x/upgrade) [#13936](https://github.com/cosmos/cosmos-sdk/pull/13936) Make downgrade verification work again. * (x/group) [#13742](https://github.com/cosmos/cosmos-sdk/pull/13742) Fix `validate-genesis` when group policy accounts exist. diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 2f227f8b4bde..960f0e59c85c 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -739,7 +739,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 { - newCtx, err := app.postHandler(runMsgCtx, tx, mode == runTxModeSimulate) + // 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) if err != nil { return gInfo, nil, nil, priority, err }