From 08962a0dcd1df633535da3f2194330c338a66b69 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Thu, 25 May 2023 14:06:09 +0200 Subject: [PATCH] Merge pull request from GHSA-3v7p-4x7p-4rx7 Co-authored-by: Carlos Rodriguez --- go.mod | 8 +++++++- modules/core/keeper/msg_server.go | 5 ++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index ee0d4f71213..76762f69f78 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,13 @@ go 1.19 module github.com/cosmos/ibc-go/v4 -retract [v4.0.0, v4.1.0] // depends on SDK version without dragonberry fix +retract ( + [v4.0.0, v4.1.0] // depends on SDK version without dragonberry fix + v4.1.1 // contains huckleberry vulnerability + v4.2.0 // contains huckleberry vulnerability + v4.3.0 // contains huckleberry vulnerability + v4.4.0 // contains huckleberry vulnerability +) require ( github.com/armon/go-metrics v0.4.1 diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 2412beba26f..bdd078a35bd 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -411,12 +411,11 @@ func (k Keeper) RecvPacket(goCtx context.Context, msg *channeltypes.MsgRecvPacke // Cache context so that we may discard state changes from callback if the acknowledgement is unsuccessful. cacheCtx, writeFn = ctx.CacheContext() ack := cbs.OnRecvPacket(cacheCtx, msg.Packet, relayer) - // NOTE: The context returned by CacheContext() refers to a new EventManager, so it needs to explicitly set events to the original context. - // Events from callback are emitted regardless of acknowledgement success - ctx.EventManager().EmitEvents(cacheCtx.EventManager().Events()) if ack == nil || ack.Success() { // write application state changes for asynchronous and successful acknowledgements writeFn() + // NOTE: The context returned by CacheContext() refers to a new EventManager, so it needs to explicitly set events to the original context. + ctx.EventManager().EmitEvents(cacheCtx.EventManager().Events()) } // Set packet acknowledgement only if the acknowledgement is not nil.