Skip to content

Commit

Permalink
chore: add redundant checks for V2 Msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
bznein committed Oct 23, 2024
1 parent 60f20f0 commit 6c49b23
Show file tree
Hide file tree
Showing 2 changed files with 466 additions and 315 deletions.
31 changes: 31 additions & 0 deletions modules/core/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types"
channeltypesv2 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types"
"github.com/cosmos/ibc-go/v9/modules/core/exported"
"github.com/cosmos/ibc-go/v9/modules/core/keeper"
)
Expand Down Expand Up @@ -89,6 +90,36 @@ func (rrd RedundantRelayDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula
return ctx, err
}

case *channeltypesv2.MsgTimeout:
response, err := rrd.k.ChannelKeeperV2.Timeout(ctx, msg)
if err != nil {
return ctx, err
}

if response.Result == channeltypes.NOOP {
redundancies++
}
packetMsgs++
case *channeltypesv2.MsgAcknowledgement:
response, err := rrd.k.ChannelKeeperV2.Acknowledgement(ctx, msg)
if err != nil {
return ctx, err
}

if response.Result == channeltypes.NOOP {
redundancies++
}
packetMsgs++
case *channeltypesv2.MsgRecvPacket:
response, err := rrd.k.ChannelKeeperV2.RecvPacket(ctx, msg)
if err != nil {
return ctx, err
}

if response.Result == channeltypes.NOOP {
redundancies++
}
packetMsgs++
default:
// if the multiMsg tx has a msg that is not a packet msg or update msg, then we will not return error
// regardless of if all packet messages are redundant. This ensures that non-packet messages get processed
Expand Down
Loading

0 comments on commit 6c49b23

Please sign in to comment.