Skip to content

Commit

Permalink
fix!: remove duplicate event emission (backport #2282) (#2301)
Browse files Browse the repository at this point in the history
fix!: remove duplicate event emission (#2282)

* remove duplicate event emission

* add changelog entry

(cherry picked from commit 47b786a)

Co-authored-by: Marius Poke <[email protected]>
  • Loading branch information
mergify[bot] and mpoke authored Sep 20, 2024
1 parent 07f2ea1 commit b27133d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .changelog/unreleased/bug-fixes/2282-duplicate-events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Remove duplicate event emission on cached context.
([\#2282](https://github.com/cosmos/interchain-security/pull/2282))
3 changes: 0 additions & 3 deletions x/ccv/consumer/keeper/distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
4 changes: 0 additions & 4 deletions x/ccv/provider/keeper/consumer_lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b27133d

Please sign in to comment.