diff --git a/go.mod b/go.mod index a6387eb199e..55236969b7a 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ go 1.19 module github.com/cosmos/ibc-go/v6 retract ( + [v6.1.1, v6.2.1] // contains ASA-2024-007 vulnerability v6.1.0 // contains huckleberry vulnerability [v6.0.0, v6.0.1] // depends on SDK version < v0.46.7 ) diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 230951ca75d..aa7d0415375 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -476,17 +476,17 @@ func (k Keeper) Timeout(goCtx context.Context, msg *channeltypes.MsgTimeout) (*c return nil, sdkerrors.Wrap(err, "timeout packet verification failed") } + // Delete packet commitment + if err = k.ChannelKeeper.TimeoutExecuted(ctx, cap, msg.Packet); err != nil { + return nil, err + } + // Perform application logic callback err = cbs.OnTimeoutPacket(ctx, msg.Packet, relayer) if err != nil { return nil, sdkerrors.Wrap(err, "timeout packet callback failed") } - // Delete packet commitment - if err = k.ChannelKeeper.TimeoutExecuted(ctx, cap, msg.Packet); err != nil { - return nil, err - } - defer func() { telemetry.IncrCounterWithLabels( []string{"ibc", "timeout", "packet"}, @@ -542,6 +542,11 @@ func (k Keeper) TimeoutOnClose(goCtx context.Context, msg *channeltypes.MsgTimeo return nil, sdkerrors.Wrap(err, "timeout on close packet verification failed") } + // Delete packet commitment + if err = k.ChannelKeeper.TimeoutExecuted(ctx, cap, msg.Packet); err != nil { + return nil, err + } + // Perform application logic callback // // NOTE: MsgTimeout and MsgTimeoutOnClose use the same "OnTimeoutPacket" @@ -551,11 +556,6 @@ func (k Keeper) TimeoutOnClose(goCtx context.Context, msg *channeltypes.MsgTimeo return nil, sdkerrors.Wrap(err, "timeout packet callback failed") } - // Delete packet commitment - if err = k.ChannelKeeper.TimeoutExecuted(ctx, cap, msg.Packet); err != nil { - return nil, err - } - defer func() { telemetry.IncrCounterWithLabels( []string{"ibc", "timeout", "packet"},