From b27133dee6f5cd71364163ab56ba7b33acac3c19 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 20 Sep 2024 18:03:27 +0200 Subject: [PATCH] fix!: remove duplicate event emission (backport #2282) (#2301) fix!: remove duplicate event emission (#2282) * remove duplicate event emission * add changelog entry (cherry picked from commit 47b786a175d353dad1a69409cf6d64687b531eba) Co-authored-by: Marius Poke --- .changelog/unreleased/bug-fixes/2282-duplicate-events.md | 2 ++ x/ccv/consumer/keeper/distribution.go | 3 --- x/ccv/provider/keeper/consumer_lifecycle.go | 4 ---- 3 files changed, 2 insertions(+), 7 deletions(-) create mode 100644 .changelog/unreleased/bug-fixes/2282-duplicate-events.md diff --git a/.changelog/unreleased/bug-fixes/2282-duplicate-events.md b/.changelog/unreleased/bug-fixes/2282-duplicate-events.md new file mode 100644 index 0000000000..f281c06f3c --- /dev/null +++ b/.changelog/unreleased/bug-fixes/2282-duplicate-events.md @@ -0,0 +1,2 @@ +- Remove duplicate event emission on cached context. + ([\#2282](https://github.com/cosmos/interchain-security/pull/2282)) \ No newline at end of file diff --git a/x/ccv/consumer/keeper/distribution.go b/x/ccv/consumer/keeper/distribution.go index 84cc98b86b..eb2175926a 100644 --- a/x/ccv/consumer/keeper/distribution.go +++ b/x/ccv/consumer/keeper/distribution.go @@ -35,9 +35,6 @@ func (k Keeper) EndBlockRD(ctx sdk.Context) { if err := k.SendRewardsToProvider(cachedCtx); err != nil { k.Logger(ctx).Error("attempt to sent rewards to provider failed", "error", err) } else { - // The cached context is created with a new EventManager so we merge the event - // into the original context - ctx.EventManager().EmitEvents(cachedCtx.EventManager().Events()) // write cache writeCache() } diff --git a/x/ccv/provider/keeper/consumer_lifecycle.go b/x/ccv/provider/keeper/consumer_lifecycle.go index 08b55b3ced..c51db4392a 100644 --- a/x/ccv/provider/keeper/consumer_lifecycle.go +++ b/x/ccv/provider/keeper/consumer_lifecycle.go @@ -115,8 +115,6 @@ func (k Keeper) BeginBlockLaunchConsumers(ctx sdk.Context) error { continue } - // the cached context is created with a new EventManager, so we merge the events into the original context - ctx.EventManager().EmitEvents(cachedCtx.EventManager().Events()) writeFn() } return nil @@ -434,8 +432,6 @@ func (k Keeper) BeginBlockRemoveConsumers(ctx sdk.Context) error { continue } - // the cached context is created with a new EventManager so we merge the event into the original context - ctx.EventManager().EmitEvents(cachedCtx.EventManager().Events()) writeFn() } return nil