From cd9b2d450b76bedc22d9e65ea445a1308ab3820c Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Thu, 6 Feb 2020 16:19:26 -0500 Subject: [PATCH] Merge PR #5622: Track proposal handler events on success --- CHANGELOG.md | 3 ++- x/gov/abci.go | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 745ed246ce..fed89e850a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,13 +56,14 @@ and provided directly the IAVL store. ### Bug Fixes +* (x/gov) [\#5622](https://github.com/cosmos/cosmos-sdk/pull/5622) Track any events emitted from a proposal's handler upon successful execution. * (types) [\#5579](https://github.com/cosmos/cosmos-sdk/pull/5579) The IAVL `Store#Commit` method has been refactored to delete a flushed version if it is not a snapshot version. The root multi-store now keeps track of `commitInfo` instead of `types.CommitID`. During `Commit` of the root multi-store, `lastCommitInfo` is updated from the saved state and is only flushed to disk if it is a snapshot version. During `Query` of the root multi-store, if the request height is the latest height, we'll use the store's `lastCommitInfo`. Otherwise, we fetch `commitInfo` from disk. * (x/bank) [\#5531](https://github.com/cosmos/cosmos-sdk/issues/5531) Added missing amount event to MsgMultiSend, emitted for each output. -* (client) [\#5618](https://github.com/cosmos/cosmos-sdk/pull/5618) Fix crash on the client when the verifier is not set. +* (client) [\#5618](https://github.com/cosmos/cosmos-sdk/pull/5618) Fix crash on the client when the verifier is not set. ### State Machine Breaking diff --git a/x/gov/abci.go b/x/gov/abci.go index 21db8f5cd2..fa990acbf0 100644 --- a/x/gov/abci.go +++ b/x/gov/abci.go @@ -60,6 +60,12 @@ func EndBlocker(ctx sdk.Context, keeper Keeper) { tagValue = types.AttributeValueProposalPassed logMsg = "passed" + // The cached context is created with a new EventManager. However, since + // the proposal handler execution was successful, we want to track/keep + // any events emitted, so we re-emit to "merge" the events into the + // original Context's EventManager. + ctx.EventManager().EmitEvents(cacheCtx.EventManager().Events()) + // write state to the underlying multi-store writeCache() } else {