From d8eecd03877ffc73cced91c706359d6e0ee32907 Mon Sep 17 00:00:00 2001 From: Sean King Date: Mon, 17 Jan 2022 18:50:22 +0100 Subject: [PATCH 1/2] refactor: update IncentivzedAck field to use Any + adding channeltype helpers for unpack/pack Any --- docs/ibc/proto-docs.md | 2 +- go.mod | 9 +-- modules/apps/29-fee/ibc_module.go | 17 ++++- modules/apps/29-fee/keeper/relay.go | 11 +++- modules/apps/29-fee/types/ack.go | 14 ++++- modules/apps/29-fee/types/ack.pb.go | 84 ++++++++++++++----------- modules/core/04-channel/types/codec.go | 34 ++++++++++ proto/ibc/applications/fee/v1/ack.proto | 7 ++- 8 files changed, 124 insertions(+), 54 deletions(-) diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index 662081f9459..9c6401ec8b4 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -332,7 +332,7 @@ It contains the raw acknowledgement bytes, as well as the forward relayer addres | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `result` | [bytes](#bytes) | | | +| `app_acknowledgement` | [google.protobuf.Any](#google.protobuf.Any) | | | | `forward_relayer_address` | [string](#string) | | | diff --git a/go.mod b/go.mod index 2a8ed9f82c6..3e5f606755d 100644 --- a/go.mod +++ b/go.mod @@ -27,12 +27,6 @@ require ( gopkg.in/yaml.v2 v2.4.0 ) -require ( - github.com/gin-gonic/gin v1.7.0 // indirect - github.com/opencontainers/image-spec v1.0.2 // indirect - github.com/opencontainers/runc v1.0.3 // indirect -) - require ( filippo.io/edwards25519 v1.0.0-beta.2 // indirect github.com/99designs/keyring v1.1.6 // indirect @@ -60,6 +54,7 @@ require ( github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b // indirect github.com/felixge/httpsnoop v1.0.1 // indirect github.com/fsnotify/fsnotify v1.5.1 // indirect + github.com/gin-gonic/gin v1.7.0 // indirect github.com/go-kit/kit v0.10.0 // indirect github.com/go-logfmt/logfmt v0.5.0 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect @@ -92,6 +87,8 @@ require ( github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.4.3 // indirect github.com/mtibben/percent v0.2.1 // indirect + github.com/opencontainers/image-spec v1.0.2 // indirect + github.com/opencontainers/runc v1.0.3 // indirect github.com/pelletier/go-toml v1.9.4 // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect diff --git a/modules/apps/29-fee/ibc_module.go b/modules/apps/29-fee/ibc_module.go index 1b54981d7ea..7751d226f9b 100644 --- a/modules/apps/29-fee/ibc_module.go +++ b/modules/apps/29-fee/ibc_module.go @@ -191,7 +191,13 @@ func (im IBCModule) OnRecvPacket( im.keeper.SetForwardRelayerAddress(ctx, channeltypes.NewPacketId(packet.GetSourceChannel(), packet.GetSourcePort(), packet.GetSequence()), forwardRelayer) } - return types.NewIncentivizedAcknowledgement(forwardRelayer, ack.Acknowledgement()) + // pack ack into an Any type + packedAck, err := channeltypes.PackAcknowledgement(ack) + if err != nil { + return nil + } + + return types.NewIncentivizedAcknowledgement(forwardRelayer, packedAck) } // OnAcknowledgementPacket implements the IBCModule interface @@ -213,16 +219,21 @@ func (im IBCModule) OnAcknowledgementPacket( packetId := channeltypes.NewPacketId(packet.SourceChannel, packet.SourcePort, packet.Sequence) + appAck, err := channeltypes.UnpackAcknowledgement(ack.AppAcknowledgement) + if err != nil { + return err + } + identifiedPacketFee, found := im.keeper.GetFeeInEscrow(ctx, packetId) if !found { // return underlying callback if no fee found for given packetID - return im.app.OnAcknowledgementPacket(ctx, packet, ack.Result, relayer) + return im.app.OnAcknowledgementPacket(ctx, packet, appAck.Acknowledgement(), relayer) } im.keeper.DistributePacketFees(ctx, identifiedPacketFee.RefundAddress, ack.ForwardRelayerAddress, relayer, identifiedPacketFee) // call underlying callback - return im.app.OnAcknowledgementPacket(ctx, packet, ack.Result, relayer) + return im.app.OnAcknowledgementPacket(ctx, packet, appAck.Acknowledgement(), relayer) } // OnTimeoutPacket implements the IBCModule interface diff --git a/modules/apps/29-fee/keeper/relay.go b/modules/apps/29-fee/keeper/relay.go index 078f22eba9f..6bca61a0357 100644 --- a/modules/apps/29-fee/keeper/relay.go +++ b/modules/apps/29-fee/keeper/relay.go @@ -23,8 +23,15 @@ func (k Keeper) WriteAcknowledgement(ctx sdk.Context, chanCap *capabilitytypes.C k.DeleteForwardRelayerAddress(ctx, packetId) - ack := types.NewIncentivizedAcknowledgement(relayer, acknowledgement) - bz := ack.Acknowledgement() + ack := channeltypes.Acknowledgement{} + k.cdc.MustUnmarshal(acknowledgement, &ack) + packedAck, err := channeltypes.PackAcknowledgement(ack) + if err != nil { + return err + } + + incentivizedAck := types.NewIncentivizedAcknowledgement(relayer, packedAck) + bz := incentivizedAck.Acknowledgement() // ics4Wrapper may be core IBC or higher-level middleware return k.ics4Wrapper.WriteAcknowledgement(ctx, chanCap, packet, bz) diff --git a/modules/apps/29-fee/types/ack.go b/modules/apps/29-fee/types/ack.go index f54214d8432..3ef111a7f97 100644 --- a/modules/apps/29-fee/types/ack.go +++ b/modules/apps/29-fee/types/ack.go @@ -1,13 +1,16 @@ package types import ( + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" + + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" ) // NewIncentivizedAcknowledgement creates a new instance of IncentivizedAcknowledgement -func NewIncentivizedAcknowledgement(relayer string, ack []byte) IncentivizedAcknowledgement { +func NewIncentivizedAcknowledgement(relayer string, ack *codectypes.Any) IncentivizedAcknowledgement { return IncentivizedAcknowledgement{ - Result: ack, + AppAcknowledgement: ack, ForwardRelayerAddress: relayer, } } @@ -16,7 +19,12 @@ func NewIncentivizedAcknowledgement(relayer string, ack []byte) IncentivizedAckn // considered successful if the forward relayer address is empty. Otherwise it is // considered a failed acknowledgement. func (ack IncentivizedAcknowledgement) Success() bool { - return ack.ForwardRelayerAddress != "" + unpackedAck, err := channeltypes.UnpackAcknowledgement(ack.AppAcknowledgement) + if err != nil { + return false + } + + return unpackedAck.Success() } // Acknowledgement implements the Acknowledgement interface. It returns the diff --git a/modules/apps/29-fee/types/ack.pb.go b/modules/apps/29-fee/types/ack.pb.go index 796fa3cd139..c2d4c378252 100644 --- a/modules/apps/29-fee/types/ack.pb.go +++ b/modules/apps/29-fee/types/ack.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + types "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" @@ -26,8 +27,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // IncentivizedAcknowledgement is the acknowledgement format to be used by applications wrapped in the fee middleware // It contains the raw acknowledgement bytes, as well as the forward relayer address type IncentivizedAcknowledgement struct { - Result []byte `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` - ForwardRelayerAddress string `protobuf:"bytes,2,opt,name=forward_relayer_address,json=forwardRelayerAddress,proto3" json:"forward_relayer_address,omitempty" yaml:"forward_relayer_address"` + AppAcknowledgement *types.Any `protobuf:"bytes,1,opt,name=app_acknowledgement,json=appAcknowledgement,proto3" json:"app_acknowledgement,omitempty" yaml:"forward_relayer_address"` + ForwardRelayerAddress string `protobuf:"bytes,2,opt,name=forward_relayer_address,json=forwardRelayerAddress,proto3" json:"forward_relayer_address,omitempty" yaml:"forward_relayer_address"` } func (m *IncentivizedAcknowledgement) Reset() { *m = IncentivizedAcknowledgement{} } @@ -63,9 +64,9 @@ func (m *IncentivizedAcknowledgement) XXX_DiscardUnknown() { var xxx_messageInfo_IncentivizedAcknowledgement proto.InternalMessageInfo -func (m *IncentivizedAcknowledgement) GetResult() []byte { +func (m *IncentivizedAcknowledgement) GetAppAcknowledgement() *types.Any { if m != nil { - return m.Result + return m.AppAcknowledgement } return nil } @@ -84,25 +85,27 @@ func init() { func init() { proto.RegisterFile("ibc/applications/fee/v1/ack.proto", fileDescriptor_ab2834946fb65ea4) } var fileDescriptor_ab2834946fb65ea4 = []byte{ - // 274 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0xd0, 0xb1, 0x4e, 0xc3, 0x30, - 0x10, 0x06, 0xe0, 0x9a, 0xa1, 0x12, 0x11, 0x53, 0x04, 0xb4, 0x02, 0xc9, 0x94, 0x4c, 0x5d, 0x1a, - 0xab, 0x54, 0x0c, 0xb0, 0xb5, 0x1b, 0x13, 0x52, 0xc6, 0x2e, 0x95, 0x63, 0x5f, 0x82, 0x55, 0x27, - 0x17, 0xd9, 0x4e, 0xaa, 0xf0, 0x14, 0xf0, 0x56, 0x8c, 0x1d, 0x99, 0x10, 0x4a, 0xde, 0x80, 0x27, - 0x40, 0x69, 0x3a, 0xb0, 0xb0, 0xdd, 0xdd, 0xff, 0x2d, 0xf7, 0x7b, 0xb7, 0x2a, 0x16, 0x8c, 0x17, - 0x85, 0x56, 0x82, 0x3b, 0x85, 0xb9, 0x65, 0x09, 0x00, 0xab, 0xe6, 0x8c, 0x8b, 0x6d, 0x58, 0x18, - 0x74, 0xe8, 0x8f, 0x54, 0x2c, 0xc2, 0xbf, 0x24, 0x4c, 0x00, 0xc2, 0x6a, 0x7e, 0x75, 0x9e, 0x62, - 0x8a, 0x07, 0xc3, 0xba, 0xa9, 0xe7, 0xc1, 0x3b, 0xf1, 0xae, 0x9f, 0x72, 0x01, 0xb9, 0x53, 0x95, - 0x7a, 0x05, 0xb9, 0x14, 0xdb, 0x1c, 0x77, 0x1a, 0x64, 0x0a, 0x19, 0xe4, 0xce, 0xbf, 0xf4, 0x86, - 0x06, 0x6c, 0xa9, 0xdd, 0x98, 0x4c, 0xc8, 0xf4, 0x2c, 0x3a, 0x6e, 0xfe, 0xda, 0x1b, 0x25, 0x68, - 0x76, 0xdc, 0xc8, 0x8d, 0x01, 0xcd, 0x6b, 0x30, 0x1b, 0x2e, 0xa5, 0x01, 0x6b, 0xc7, 0x27, 0x13, - 0x32, 0x3d, 0x5d, 0x05, 0x3f, 0x5f, 0x37, 0xb4, 0xe6, 0x99, 0x7e, 0x0c, 0xfe, 0x81, 0x41, 0x74, - 0x71, 0x4c, 0xa2, 0x3e, 0x58, 0xf6, 0xf7, 0xd5, 0xf3, 0x47, 0x43, 0xc9, 0xbe, 0xa1, 0xe4, 0xbb, - 0xa1, 0xe4, 0xad, 0xa5, 0x83, 0x7d, 0x4b, 0x07, 0x9f, 0x2d, 0x1d, 0xac, 0xef, 0x53, 0xe5, 0x5e, - 0xca, 0x38, 0x14, 0x98, 0x31, 0x81, 0x36, 0x43, 0xcb, 0x54, 0x2c, 0x66, 0x29, 0xb2, 0x6a, 0xc1, - 0x32, 0x94, 0xa5, 0x06, 0xdb, 0xf5, 0x63, 0xd9, 0xdd, 0xc3, 0xac, 0xab, 0xc6, 0xd5, 0x05, 0xd8, - 0x78, 0x78, 0xf8, 0x75, 0xf1, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x50, 0xc6, 0xd5, 0xaa, 0x3f, 0x01, - 0x00, 0x00, + // 307 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xb1, 0x4a, 0x03, 0x41, + 0x10, 0x86, 0xb3, 0x16, 0x82, 0x67, 0x17, 0x23, 0x89, 0x11, 0xd6, 0x78, 0x55, 0x9a, 0xec, 0x92, + 0x04, 0x0b, 0xed, 0x92, 0xce, 0x4a, 0x48, 0x99, 0x26, 0xec, 0xed, 0xcd, 0xad, 0x4b, 0xee, 0x76, + 0x96, 0xdb, 0xcd, 0x85, 0xf3, 0x29, 0x7c, 0x2c, 0xcb, 0x94, 0x56, 0x22, 0x89, 0x4f, 0xe0, 0x13, + 0x48, 0xee, 0x14, 0x54, 0x10, 0xec, 0x66, 0xfe, 0xff, 0xe3, 0x1f, 0x86, 0x3f, 0xb8, 0xd4, 0x91, + 0xe4, 0xc2, 0xda, 0x54, 0x4b, 0xe1, 0x35, 0x1a, 0xc7, 0x13, 0x00, 0x5e, 0x0c, 0xb9, 0x90, 0x4b, + 0x66, 0x73, 0xf4, 0xd8, 0x6c, 0xeb, 0x48, 0xb2, 0xef, 0x08, 0x4b, 0x00, 0x58, 0x31, 0xec, 0xb6, + 0x14, 0x2a, 0xac, 0x18, 0xbe, 0x9f, 0x6a, 0xbc, 0x7b, 0xa6, 0x10, 0x55, 0x0a, 0xbc, 0xda, 0xa2, + 0x55, 0xc2, 0x85, 0x29, 0x6b, 0x2b, 0x7c, 0x23, 0xc1, 0xf9, 0xad, 0x91, 0x60, 0xbc, 0x2e, 0xf4, + 0x03, 0xc4, 0x13, 0xb9, 0x34, 0xb8, 0x4e, 0x21, 0x56, 0x90, 0x81, 0xf1, 0x4d, 0x1d, 0x9c, 0x08, + 0x6b, 0x17, 0xe2, 0xa7, 0xdc, 0x21, 0x3d, 0xd2, 0x3f, 0x1e, 0xb5, 0x58, 0x1d, 0xcc, 0xbe, 0x82, + 0xd9, 0xc4, 0x94, 0xd3, 0xf0, 0xfd, 0xe5, 0x82, 0x96, 0x22, 0x4b, 0x6f, 0xc2, 0x04, 0xf3, 0xb5, + 0xc8, 0xe3, 0x45, 0x0e, 0xa9, 0x28, 0x21, 0x5f, 0x88, 0x38, 0xce, 0xc1, 0xb9, 0x70, 0xd6, 0x14, + 0xd6, 0xfe, 0x3e, 0x35, 0x0f, 0xda, 0x7f, 0xf0, 0x9d, 0x83, 0x1e, 0xe9, 0x1f, 0xfd, 0x2b, 0xf8, + 0xf4, 0xd3, 0x99, 0xd5, 0xc6, 0xa4, 0xd6, 0xa7, 0x77, 0x4f, 0x5b, 0x4a, 0x36, 0x5b, 0x4a, 0x5e, + 0xb7, 0x94, 0x3c, 0xee, 0x68, 0x63, 0xb3, 0xa3, 0x8d, 0xe7, 0x1d, 0x6d, 0xcc, 0xaf, 0x94, 0xf6, + 0xf7, 0xab, 0x88, 0x49, 0xcc, 0xb8, 0x44, 0x97, 0xa1, 0xe3, 0x3a, 0x92, 0x03, 0x85, 0xbc, 0x18, + 0xf3, 0x0c, 0xe3, 0x55, 0x0a, 0x6e, 0xdf, 0x86, 0xe3, 0xa3, 0xeb, 0xc1, 0xbe, 0x08, 0x5f, 0x5a, + 0x70, 0xd1, 0x61, 0xf5, 0xf2, 0xf8, 0x23, 0x00, 0x00, 0xff, 0xff, 0x33, 0xa5, 0xad, 0xc5, 0xad, + 0x01, 0x00, 0x00, } func (m *IncentivizedAcknowledgement) Marshal() (dAtA []byte, err error) { @@ -132,10 +135,15 @@ func (m *IncentivizedAcknowledgement) MarshalToSizedBuffer(dAtA []byte) (int, er i-- dAtA[i] = 0x12 } - if len(m.Result) > 0 { - i -= len(m.Result) - copy(dAtA[i:], m.Result) - i = encodeVarintAck(dAtA, i, uint64(len(m.Result))) + if m.AppAcknowledgement != nil { + { + size, err := m.AppAcknowledgement.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAck(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa } @@ -159,8 +167,8 @@ func (m *IncentivizedAcknowledgement) Size() (n int) { } var l int _ = l - l = len(m.Result) - if l > 0 { + if m.AppAcknowledgement != nil { + l = m.AppAcknowledgement.Size() n += 1 + l + sovAck(uint64(l)) } l = len(m.ForwardRelayerAddress) @@ -207,9 +215,9 @@ func (m *IncentivizedAcknowledgement) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AppAcknowledgement", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowAck @@ -219,24 +227,26 @@ func (m *IncentivizedAcknowledgement) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthAck } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthAck } if postIndex > l { return io.ErrUnexpectedEOF } - m.Result = append(m.Result[:0], dAtA[iNdEx:postIndex]...) - if m.Result == nil { - m.Result = []byte{} + if m.AppAcknowledgement == nil { + m.AppAcknowledgement = &types.Any{} + } + if err := m.AppAcknowledgement.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 2: diff --git a/modules/core/04-channel/types/codec.go b/modules/core/04-channel/types/codec.go index 8981417130b..31228f8ff42 100644 --- a/modules/core/04-channel/types/codec.go +++ b/modules/core/04-channel/types/codec.go @@ -4,7 +4,9 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/msgservice" + proto "github.com/gogo/protobuf/proto" "github.com/cosmos/ibc-go/v3/modules/core/exported" ) @@ -50,3 +52,35 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { // The actual codec used for serialization should be provided to x/ibc/core/04-channel and // defined at the application level. var SubModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) + +// UnpackAcknowledgement unpacks an Any into an Acknowledgement. It returns an error if the +// acknowledgement can't be unpacked into a Acknowledgement. +func UnpackAcknowledgement(any *codectypes.Any) (exported.Acknowledgement, error) { + if any == nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrUnpackAny, "protobuf Any message cannot be nil") + } + + ack, ok := any.GetCachedValue().(exported.Acknowledgement) + if !ok { + return nil, sdkerrors.Wrapf(sdkerrors.ErrUnpackAny, "cannot unpack Any into Acknowledgement %T", any) + } + + return ack, nil +} + +// PackAcknowledgement constructs a new Any packed with the given acknowledgement value. It returns +// an error if the acknowledgement can't be casted to a protobuf message or if the concrete +// implemention is not registered to the protobuf codec. +func PackAcknowledgement(acknowledgement exported.Acknowledgement) (*codectypes.Any, error) { + msg, ok := acknowledgement.(proto.Message) + if !ok { + return nil, sdkerrors.Wrapf(sdkerrors.ErrPackAny, "cannot proto marshal %T", acknowledgement) + } + + anyAcknowledgement, err := codectypes.NewAnyWithValue(msg) + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrPackAny, err.Error()) + } + + return anyAcknowledgement, nil +} diff --git a/proto/ibc/applications/fee/v1/ack.proto b/proto/ibc/applications/fee/v1/ack.proto index 626b4518f18..209fe351404 100644 --- a/proto/ibc/applications/fee/v1/ack.proto +++ b/proto/ibc/applications/fee/v1/ack.proto @@ -1,12 +1,15 @@ syntax = "proto3"; package ibc.applications.fee.v1; -import "gogoproto/gogo.proto"; + option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types"; +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; + // IncentivizedAcknowledgement is the acknowledgement format to be used by applications wrapped in the fee middleware // It contains the raw acknowledgement bytes, as well as the forward relayer address message IncentivizedAcknowledgement { - bytes result = 1; + google.protobuf.Any app_acknowledgement = 1 [(gogoproto.moretags) = "yaml:\"forward_relayer_address\""]; string forward_relayer_address = 2 [(gogoproto.moretags) = "yaml:\"forward_relayer_address\""]; } From b727630fc9781d21f98d95aaa1be30498aba1784 Mon Sep 17 00:00:00 2001 From: Sean King Date: Thu, 10 Feb 2022 16:45:37 +0100 Subject: [PATCH 2/2] fix: adding RegisterImplementation for codec --- modules/core/04-channel/types/codec.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/core/04-channel/types/codec.go b/modules/core/04-channel/types/codec.go index 31228f8ff42..3d87e30fa56 100644 --- a/modules/core/04-channel/types/codec.go +++ b/modules/core/04-channel/types/codec.go @@ -29,6 +29,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { (*exported.PacketI)(nil), &Packet{}, ) + registry.RegisterImplementations( (*sdk.Msg)(nil), &MsgChannelOpenInit{}, @@ -42,6 +43,10 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { &MsgTimeout{}, &MsgTimeoutOnClose{}, ) + registry.RegisterImplementations( + (*exported.Acknowledgement)(nil), + &Acknowledgement{}, + ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) }