diff --git a/x/wasm/keeper/handler_plugin.go b/x/wasm/keeper/handler_plugin.go index 99505d3a52..9e55385ca8 100644 --- a/x/wasm/keeper/handler_plugin.go +++ b/x/wasm/keeper/handler_plugin.go @@ -9,6 +9,7 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + ibctypes "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types" channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v5/modules/core/24-host" @@ -192,8 +193,16 @@ func (h IBCRawPacketHandler) DispatchMsg(ctx sdk.Context, _ sdk.AccAddress, cont return nil, nil, sdkerrors.Wrap(err, "failed to send packet") } - // Encode the sequence in big endian order and append it to data so that it can be retrieved by contract - data = append(data, sdk.Uint64ToBigEndian(sequence)) + // Encode the sequence in a struct and append it to data so that it can be retrieved by contract + // we're reusing MsgTransferResponse here because it's the same proto, but it would be cleaner to not do this + resp := &ibctypes.MsgTransferResponse { Sequence: sequence} + val, err := resp.Marshal() + + if err != nil { + return nil, nil, sdkerrors.Wrap(err, "failed to marshal sequence response") + } + + data = append(data, val) return }