From a31ab6c3abab888c8293b53c1789b8f1dafd69c6 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Mon, 7 Feb 2022 18:50:05 +0100 Subject: [PATCH 1/6] adding metadata type to ics29 protos --- docs/ibc/proto-docs.md | 36 ++ modules/apps/29-fee/types/metadata.pb.go | 377 +++++++++++++++++++ proto/ibc/applications/fee/v1/fee.proto | 9 +- proto/ibc/applications/fee/v1/genesis.proto | 6 +- proto/ibc/applications/fee/v1/metadata.proto | 16 + proto/ibc/applications/fee/v1/query.proto | 2 +- 6 files changed, 439 insertions(+), 7 deletions(-) create mode 100644 modules/apps/29-fee/types/metadata.pb.go create mode 100644 proto/ibc/applications/fee/v1/metadata.proto diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index 284a8718f00..b2430921566 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -38,6 +38,9 @@ - [GenesisState](#ibc.applications.fee.v1.GenesisState) - [RegisteredRelayerAddress](#ibc.applications.fee.v1.RegisteredRelayerAddress) +- [ibc/applications/fee/v1/metadata.proto](#ibc/applications/fee/v1/metadata.proto) + - [Metadata](#ibc.applications.fee.v1.Metadata) + - [ibc/applications/fee/v1/query.proto](#ibc/applications/fee/v1/query.proto) - [QueryIncentivizedPacketRequest](#ibc.applications.fee.v1.QueryIncentivizedPacketRequest) - [QueryIncentivizedPacketResponse](#ibc.applications.fee.v1.QueryIncentivizedPacketResponse) @@ -812,6 +815,39 @@ RegisteredRelayerAddress contains the address and counterparty address for a spe + + + + + + + + + + + +

Top

+ +## ibc/applications/fee/v1/metadata.proto + + + + + +### Metadata +Metadata defines the ICS29 channel specific metadata encoded into the channel version bytestring +See ICS004: https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#Versioning + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `version` | [string](#string) | | version defines the ICS29 fee version | +| `app_version` | [string](#string) | | app_version defines the underlying application version, which may or may not be a JSON encoded bytestring | + + + + + diff --git a/modules/apps/29-fee/types/metadata.pb.go b/modules/apps/29-fee/types/metadata.pb.go new file mode 100644 index 00000000000..14a1f4ae570 --- /dev/null +++ b/modules/apps/29-fee/types/metadata.pb.go @@ -0,0 +1,377 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: ibc/applications/fee/v1/metadata.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Metadata defines the ICS29 channel specific metadata encoded into the channel version bytestring +// See ICS004: https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#Versioning +type Metadata struct { + // version defines the ICS29 fee version + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // app_version defines the underlying application version, which may or may not be a JSON encoded bytestring + AppVersion string `protobuf:"bytes,2,opt,name=app_version,json=appVersion,proto3" json:"app_version,omitempty" yaml:"app_version"` +} + +func (m *Metadata) Reset() { *m = Metadata{} } +func (m *Metadata) String() string { return proto.CompactTextString(m) } +func (*Metadata) ProtoMessage() {} +func (*Metadata) Descriptor() ([]byte, []int) { + return fileDescriptor_03d0f000eda681ce, []int{0} +} +func (m *Metadata) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Metadata.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Metadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_Metadata.Merge(m, src) +} +func (m *Metadata) XXX_Size() int { + return m.Size() +} +func (m *Metadata) XXX_DiscardUnknown() { + xxx_messageInfo_Metadata.DiscardUnknown(m) +} + +var xxx_messageInfo_Metadata proto.InternalMessageInfo + +func (m *Metadata) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *Metadata) GetAppVersion() string { + if m != nil { + return m.AppVersion + } + return "" +} + +func init() { + proto.RegisterType((*Metadata)(nil), "ibc.applications.fee.v1.Metadata") +} + +func init() { + proto.RegisterFile("ibc/applications/fee/v1/metadata.proto", fileDescriptor_03d0f000eda681ce) +} + +var fileDescriptor_03d0f000eda681ce = []byte{ + // 239 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcb, 0x4c, 0x4a, 0xd6, + 0x4f, 0x2c, 0x28, 0xc8, 0xc9, 0x4c, 0x4e, 0x2c, 0xc9, 0xcc, 0xcf, 0x2b, 0xd6, 0x4f, 0x4b, 0x4d, + 0xd5, 0x2f, 0x33, 0xd4, 0xcf, 0x4d, 0x2d, 0x49, 0x4c, 0x49, 0x2c, 0x49, 0xd4, 0x2b, 0x28, 0xca, + 0x2f, 0xc9, 0x17, 0x12, 0xcf, 0x4c, 0x4a, 0xd6, 0x43, 0x56, 0xa7, 0x97, 0x96, 0x9a, 0xaa, 0x57, + 0x66, 0x28, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa3, 0x0f, 0x62, 0x41, 0x94, 0x2b, 0xc5, + 0x72, 0x71, 0xf8, 0x42, 0x0d, 0x10, 0x92, 0xe0, 0x62, 0x2f, 0x4b, 0x2d, 0x2a, 0xce, 0xcc, 0xcf, + 0x93, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x82, 0x71, 0x85, 0xcc, 0xb9, 0xb8, 0x13, 0x0b, 0x0a, + 0xe2, 0x61, 0xb2, 0x4c, 0x20, 0x59, 0x27, 0xb1, 0x4f, 0xf7, 0xe4, 0x85, 0x2a, 0x13, 0x73, 0x73, + 0xac, 0x94, 0x90, 0x24, 0x95, 0x82, 0xb8, 0x12, 0x0b, 0x0a, 0xc2, 0x20, 0x1c, 0x27, 0xff, 0x13, + 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, + 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, + 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0xcf, 0x4c, 0x4a, 0xd6, + 0x4d, 0xcf, 0xd7, 0x2f, 0x33, 0xd6, 0xcf, 0xcd, 0x4f, 0x29, 0xcd, 0x49, 0x2d, 0x06, 0xf9, 0xb7, + 0x58, 0xdf, 0xc8, 0x52, 0x17, 0xe4, 0xd5, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0xb3, + 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3d, 0x6f, 0x79, 0x1f, 0x0f, 0x01, 0x00, 0x00, +} + +func (m *Metadata) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Metadata) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Metadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AppVersion) > 0 { + i -= len(m.AppVersion) + copy(dAtA[i:], m.AppVersion) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.AppVersion))) + i-- + dAtA[i] = 0x12 + } + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintMetadata(dAtA []byte, offset int, v uint64) int { + offset -= sovMetadata(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Metadata) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Version) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + l = len(m.AppVersion) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + return n +} + +func sovMetadata(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozMetadata(x uint64) (n int) { + return sovMetadata(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Metadata) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Metadata: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Metadata: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AppVersion", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AppVersion = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMetadata(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMetadata + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipMetadata(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetadata + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetadata + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetadata + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthMetadata + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupMetadata + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthMetadata + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthMetadata = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMetadata = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupMetadata = fmt.Errorf("proto: unexpected end of group") +) diff --git a/proto/ibc/applications/fee/v1/fee.proto b/proto/ibc/applications/fee/v1/fee.proto index b57cc2cc03c..bbbd82663e1 100644 --- a/proto/ibc/applications/fee/v1/fee.proto +++ b/proto/ibc/applications/fee/v1/fee.proto @@ -34,8 +34,9 @@ message Fee { // the refund address to which any unused funds are refunded, // and an optional list of relayers that are permitted to receive the fee. message IdentifiedPacketFee { - ibc.core.channel.v1.PacketId packet_id = 1 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"packet_id\""]; - Fee fee = 2 [(gogoproto.nullable) = false]; - string refund_address = 3 [(gogoproto.moretags) = "yaml:\"refund_address\""]; - repeated string relayers = 4; + ibc.core.channel.v1.PacketId packet_id = 1 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"packet_id\""]; + Fee fee = 2 [(gogoproto.nullable) = false]; + string refund_address = 3 [(gogoproto.moretags) = "yaml:\"refund_address\""]; + repeated string relayers = 4; } diff --git a/proto/ibc/applications/fee/v1/genesis.proto b/proto/ibc/applications/fee/v1/genesis.proto index cf88fc6602a..2396cf6d272 100644 --- a/proto/ibc/applications/fee/v1/genesis.proto +++ b/proto/ibc/applications/fee/v1/genesis.proto @@ -10,7 +10,8 @@ import "ibc/core/channel/v1/channel.proto"; // GenesisState defines the fee middleware genesis state message GenesisState { - repeated IdentifiedPacketFee identified_fees = 1 [(gogoproto.moretags) = "yaml:\"identified_fees\"", (gogoproto.nullable) = false]; + repeated IdentifiedPacketFee identified_fees = 1 + [(gogoproto.moretags) = "yaml:\"identified_fees\"", (gogoproto.nullable) = false]; repeated FeeEnabledChannel fee_enabled_channels = 2 [(gogoproto.moretags) = "yaml:\"fee_enabled_channels\""]; repeated RegisteredRelayerAddress registered_relayers = 3 [(gogoproto.moretags) = "yaml:\"registered_relayers\""]; repeated ForwardRelayerAddress forward_relayers = 4 [(gogoproto.moretags) = "yaml:\"forward_relayers\""]; @@ -31,5 +32,6 @@ message RegisteredRelayerAddress { // ForwardRelayerAddress contains the forward relayer address and packetId used for async acknowledgements message ForwardRelayerAddress { string address = 1; - ibc.core.channel.v1.PacketId packet_id = 2 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"packet_id\""]; + ibc.core.channel.v1.PacketId packet_id = 2 + [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"packet_id\""]; } diff --git a/proto/ibc/applications/fee/v1/metadata.proto b/proto/ibc/applications/fee/v1/metadata.proto new file mode 100644 index 00000000000..d2413664415 --- /dev/null +++ b/proto/ibc/applications/fee/v1/metadata.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package ibc.applications.fee.v1; + +option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types"; + +import "gogoproto/gogo.proto"; + +// Metadata defines the ICS29 channel specific metadata encoded into the channel version bytestring +// See ICS004: https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#Versioning +message Metadata { + // version defines the ICS29 fee version + string version = 1; + // app_version defines the underlying application version, which may or may not be a JSON encoded bytestring + string app_version = 2 [(gogoproto.moretags) = "yaml:\"app_version\""]; +} diff --git a/proto/ibc/applications/fee/v1/query.proto b/proto/ibc/applications/fee/v1/query.proto index 1a41c3091c4..47db939a512 100644 --- a/proto/ibc/applications/fee/v1/query.proto +++ b/proto/ibc/applications/fee/v1/query.proto @@ -43,7 +43,7 @@ message QueryIncentivizedPacketsResponse { // QueryIncentivizedPacketRequest is the request type for querying for all incentivized packets message QueryIncentivizedPacketRequest { // PacketID - ibc.core.channel.v1.PacketId packet_id = 1[(gogoproto.nullable) = false]; + ibc.core.channel.v1.PacketId packet_id = 1 [(gogoproto.nullable) = false]; // Height to query at uint64 query_height = 2; } From c542c46776ff2e94c045a528b297911104f0f9fc Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Mon, 7 Feb 2022 18:50:34 +0100 Subject: [PATCH 2/6] updating ics29 handshake handlers to support json encoded metadata --- modules/apps/29-fee/ibc_module.go | 76 +++++++++++++++++-------------- 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/modules/apps/29-fee/ibc_module.go b/modules/apps/29-fee/ibc_module.go index ac4ea21ca52..5f33bbd240b 100644 --- a/modules/apps/29-fee/ibc_module.go +++ b/modules/apps/29-fee/ibc_module.go @@ -37,22 +37,24 @@ func (im IBCModule) OnChanOpenInit( counterparty channeltypes.Counterparty, version string, ) error { - mwVersion, appVersion := channeltypes.SplitChannelVersion(version) - // Since it is valid for fee version to not be specified, the above middleware version may be for a middleware - // lower down in the stack. Thus, if it is not a fee version we pass the entire version string onto the underlying - // application. - // If an invalid fee version was passed, we expect the underlying application to fail on its version negotiation. - if mwVersion == types.Version { - im.keeper.SetFeeEnabled(ctx, portID, channelID) - } else { - // middleware version is not the expected version for this midddleware. Pass the full version string along, - // if it not valid version for any other lower middleware, an error will be returned by base application. - appVersion = version + var versionMetadata types.Metadata + if err := types.ModuleCdc.UnmarshalJSON([]byte(version), &versionMetadata); err != nil { + // Since it is valid for fee version to not be specified, the above middleware version may be for a middleware + // lower down in the stack. Thus, if it is not a fee version we pass the entire version string onto the underlying + // application. + return im.app.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, + chanCap, counterparty, version) } + if versionMetadata.Version != types.Version { + return sdkerrors.Wrapf(types.ErrInvalidVersion, "expected %s got %s", types.Version, versionMetadata.Version) + } + + im.keeper.SetFeeEnabled(ctx, portID, channelID) + // call underlying app's OnChanOpenInit callback with the appVersion return im.app.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, - chanCap, counterparty, appVersion) + chanCap, counterparty, versionMetadata.AppVersion) } // OnChanOpenTry implements the IBCModule interface @@ -68,31 +70,34 @@ func (im IBCModule) OnChanOpenTry( counterparty channeltypes.Counterparty, counterpartyVersion string, ) (string, error) { - cpMwVersion, cpAppVersion := channeltypes.SplitChannelVersion(counterpartyVersion) + var versionMetadata types.Metadata + if err := types.ModuleCdc.UnmarshalJSON([]byte(counterpartyVersion), &versionMetadata); err != nil { + // Since it is valid for fee version to not be specified, the above middleware version may be for a middleware + // lower down in the stack. Thus, if it is not a fee version we pass the entire version string onto the underlying + // application. + return im.app.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, counterpartyVersion) + } - // Since it is valid for fee version to not be specified, the above middleware version may be for a middleware - // lower down in the stack. Thus, if it is not a fee version we pass the entire version string onto the underlying - // application. - // If an invalid fee version was passed, we expect the underlying application to fail on its version negotiation. - if cpMwVersion == types.Version { - im.keeper.SetFeeEnabled(ctx, portID, channelID) - } else { - // middleware versions are not the expected version for this midddleware. Pass the full version strings along, - // if it not valid version for any other lower middleware, an error will be returned by base application. - cpAppVersion = counterpartyVersion + if versionMetadata.Version != types.Version { + return "", sdkerrors.Wrapf(types.ErrInvalidVersion, "expected %s got %s", types.Version, versionMetadata.Version) } + im.keeper.SetFeeEnabled(ctx, portID, channelID) + // call underlying app's OnChanOpenTry callback with the app versions - appVersion, err := im.app.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, cpAppVersion) + appVersion, err := im.app.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, versionMetadata.AppVersion) if err != nil { return "", err } - if !im.keeper.IsFeeEnabled(ctx, portID, channelID) { - return appVersion, nil + versionMetadata.AppVersion = appVersion + + versionBytes, err := types.ModuleCdc.MarshalJSON(&versionMetadata) + if err != nil { + return "", err } - return channeltypes.MergeChannelVersions(types.Version, appVersion), nil + return string(versionBytes), nil } // OnChanOpenAck implements the IBCModule interface @@ -104,17 +109,22 @@ func (im IBCModule) OnChanOpenAck( ) error { // If handshake was initialized with fee enabled it must complete with fee enabled. // If handshake was initialized with fee disabled it must complete with fee disabled. - cpAppVersion := counterpartyVersion if im.keeper.IsFeeEnabled(ctx, portID, channelID) { - var cpFeeVersion string - cpFeeVersion, cpAppVersion = channeltypes.SplitChannelVersion(counterpartyVersion) + var versionMetadata types.Metadata + if err := types.ModuleCdc.UnmarshalJSON([]byte(counterpartyVersion), &versionMetadata); err != nil { + return sdkerrors.Wrap(types.ErrInvalidVersion, "failed to unmarshal ICS29 counterparty version metadata") + } - if cpFeeVersion != types.Version { - return sdkerrors.Wrapf(types.ErrInvalidVersion, "expected counterparty version: %s, got: %s", types.Version, cpFeeVersion) + if versionMetadata.Version != types.Version { + return sdkerrors.Wrapf(types.ErrInvalidVersion, "expected counterparty version: %s, got: %s", types.Version, versionMetadata.Version) } + + // call underlying app's OnChanOpenAck callback with the counterparty app version. + return im.app.OnChanOpenAck(ctx, portID, channelID, versionMetadata.AppVersion) } + // call underlying app's OnChanOpenAck callback with the counterparty app version. - return im.app.OnChanOpenAck(ctx, portID, channelID, cpAppVersion) + return im.app.OnChanOpenAck(ctx, portID, channelID, counterpartyVersion) } // OnChanOpenConfirm implements the IBCModule interface From 015580f3c7acb1e177f8de2807ea2e0418b453dc Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Mon, 7 Feb 2022 18:50:53 +0100 Subject: [PATCH 3/6] updating tests to support json encoded metadata --- modules/apps/29-fee/fee_test.go | 2 +- modules/apps/29-fee/ibc_module_test.go | 50 ++++++++++------------- modules/apps/29-fee/keeper/keeper_test.go | 2 +- 3 files changed, 24 insertions(+), 30 deletions(-) diff --git a/modules/apps/29-fee/fee_test.go b/modules/apps/29-fee/fee_test.go index 147bd0b01a4..c8b57cb7792 100644 --- a/modules/apps/29-fee/fee_test.go +++ b/modules/apps/29-fee/fee_test.go @@ -30,7 +30,7 @@ func (suite *FeeTestSuite) SetupTest() { suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1)) path := ibctesting.NewPath(suite.chainA, suite.chainB) - feeTransferVersion := channeltypes.MergeChannelVersions(types.Version, transfertypes.Version) + feeTransferVersion := string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: transfertypes.Version})) path.EndpointA.ChannelConfig.Version = feeTransferVersion path.EndpointB.ChannelConfig.Version = feeTransferVersion path.EndpointA.ChannelConfig.PortID = transfertypes.PortID diff --git a/modules/apps/29-fee/ibc_module_test.go b/modules/apps/29-fee/ibc_module_test.go index 715a2509344..5691cd2083d 100644 --- a/modules/apps/29-fee/ibc_module_test.go +++ b/modules/apps/29-fee/ibc_module_test.go @@ -1,8 +1,6 @@ package fee_test import ( - "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" @@ -28,28 +26,23 @@ func (suite *FeeTestSuite) TestOnChanOpenInit() { expPass bool }{ { - "valid fee middleware and transfer version", - channeltypes.MergeChannelVersions(types.Version, transfertypes.Version), + "success - valid fee middleware and transfer version", + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: transfertypes.Version})), true, }, { - "fee version not included, only perform transfer logic", + "success - fee version not included, only perform transfer logic", transfertypes.Version, true, }, { "invalid fee middleware version", - channeltypes.MergeChannelVersions("otherfee28-1", transfertypes.Version), + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: "invalid-ics29-1", AppVersion: transfertypes.Version})), false, }, { "invalid transfer version", - channeltypes.MergeChannelVersions(types.Version, "wrongics20-1"), - false, - }, - { - "incorrect wrapping delimiter", - fmt.Sprintf("%s//%s", types.Version, transfertypes.Version), + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: "invalid-ics20-1"})), false, }, { @@ -57,11 +50,6 @@ func (suite *FeeTestSuite) TestOnChanOpenInit() { types.Version, false, }, - { - "hanging delimiter", - fmt.Sprintf("%s:%s:", types.Version, transfertypes.Version), - false, - }, } for _, tc := range testCases { @@ -112,32 +100,32 @@ func (suite *FeeTestSuite) TestOnChanOpenTry() { expPass bool }{ { - "valid fee middleware version", - channeltypes.MergeChannelVersions(types.Version, transfertypes.Version), + "success - valid fee middleware version", + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: transfertypes.Version})), false, true, }, { - "valid transfer version", + "success - valid transfer version", transfertypes.Version, false, true, }, { - "crossing hellos: valid fee middleware", - channeltypes.MergeChannelVersions(types.Version, transfertypes.Version), + "success - crossing hellos: valid fee middleware", + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: transfertypes.Version})), true, true, }, { "invalid fee middleware version", - channeltypes.MergeChannelVersions("wrongfee29-1", transfertypes.Version), + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: "invalid-ics29-1", AppVersion: transfertypes.Version})), false, false, }, { "invalid transfer version", - channeltypes.MergeChannelVersions(types.Version, "wrongics20-1"), + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: "invalid-ics20-1"})), false, false, }, @@ -205,25 +193,31 @@ func (suite *FeeTestSuite) TestOnChanOpenAck() { }{ { "success", - channeltypes.MergeChannelVersions(types.Version, transfertypes.Version), + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: transfertypes.Version})), func(suite *FeeTestSuite) {}, true, }, { "invalid fee version", - channeltypes.MergeChannelVersions("fee29-A", transfertypes.Version), + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: "invalid-ics29-1", AppVersion: transfertypes.Version})), func(suite *FeeTestSuite) {}, false, }, { "invalid transfer version", - channeltypes.MergeChannelVersions(types.Version, "ics20-4"), + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: "invalid-ics20-1"})), + func(suite *FeeTestSuite) {}, + false, + }, + { + "invalid version fails to unmarshal metadata", + "invalid-version", func(suite *FeeTestSuite) {}, false, }, { "previous INIT set without fee, however counterparty set fee version", // note this can only happen with incompetent or malicious counterparty chain - channeltypes.MergeChannelVersions(types.Version, transfertypes.Version), + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: transfertypes.Version})), func(suite *FeeTestSuite) { // do the first steps without fee version, then pass the fee version as counterparty version in ChanOpenACK suite.path.EndpointA.ChannelConfig.Version = transfertypes.Version diff --git a/modules/apps/29-fee/keeper/keeper_test.go b/modules/apps/29-fee/keeper/keeper_test.go index bfea0dabcd9..e84ea4d53dd 100644 --- a/modules/apps/29-fee/keeper/keeper_test.go +++ b/modules/apps/29-fee/keeper/keeper_test.go @@ -40,7 +40,7 @@ func (suite *KeeperTestSuite) SetupTest() { suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1)) path := ibctesting.NewPath(suite.chainA, suite.chainB) - feeTransferVersion := channeltypes.MergeChannelVersions(types.Version, transfertypes.Version) + feeTransferVersion := string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: transfertypes.Version})) path.EndpointA.ChannelConfig.Version = feeTransferVersion path.EndpointB.ChannelConfig.Version = feeTransferVersion path.EndpointA.ChannelConfig.PortID = transfertypes.PortID From ef37a84ef1e2b63fc793e56d5bc2e817e62a41c6 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Tue, 8 Feb 2022 12:34:00 +0100 Subject: [PATCH 4/6] Update modules/apps/29-fee/ibc_module.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> --- modules/apps/29-fee/ibc_module.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/apps/29-fee/ibc_module.go b/modules/apps/29-fee/ibc_module.go index 5f33bbd240b..72d8b12f914 100644 --- a/modules/apps/29-fee/ibc_module.go +++ b/modules/apps/29-fee/ibc_module.go @@ -47,7 +47,7 @@ func (im IBCModule) OnChanOpenInit( } if versionMetadata.Version != types.Version { - return sdkerrors.Wrapf(types.ErrInvalidVersion, "expected %s got %s", types.Version, versionMetadata.Version) + return sdkerrors.Wrapf(types.ErrInvalidVersion, "expected %s, got %s", types.Version, versionMetadata.Version) } im.keeper.SetFeeEnabled(ctx, portID, channelID) From 5e409c4f6735048681d8f873a3d8d8902899033a Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Tue, 8 Feb 2022 12:34:07 +0100 Subject: [PATCH 5/6] Update modules/apps/29-fee/ibc_module.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> --- modules/apps/29-fee/ibc_module.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/apps/29-fee/ibc_module.go b/modules/apps/29-fee/ibc_module.go index 72d8b12f914..e1a8870c1a3 100644 --- a/modules/apps/29-fee/ibc_module.go +++ b/modules/apps/29-fee/ibc_module.go @@ -79,7 +79,7 @@ func (im IBCModule) OnChanOpenTry( } if versionMetadata.Version != types.Version { - return "", sdkerrors.Wrapf(types.ErrInvalidVersion, "expected %s got %s", types.Version, versionMetadata.Version) + return "", sdkerrors.Wrapf(types.ErrInvalidVersion, "expected %s, got %s", types.Version, versionMetadata.Version) } im.keeper.SetFeeEnabled(ctx, portID, channelID) From 4645d66c240f35f1d818799e1d17f1db5846d998 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Tue, 8 Feb 2022 17:07:59 +0100 Subject: [PATCH 6/6] renaming metadata version to fee_version --- docs/ibc/proto-docs.md | 2 +- modules/apps/29-fee/fee_test.go | 2 +- modules/apps/29-fee/ibc_module.go | 12 ++--- modules/apps/29-fee/ibc_module_test.go | 22 ++++----- modules/apps/29-fee/keeper/keeper_test.go | 2 +- modules/apps/29-fee/types/metadata.pb.go | 47 ++++++++++---------- proto/ibc/applications/fee/v1/metadata.proto | 4 +- 7 files changed, 46 insertions(+), 45 deletions(-) diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index b2430921566..fb67b288640 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -841,7 +841,7 @@ See ICS004: https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel- | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `version` | [string](#string) | | version defines the ICS29 fee version | +| `fee_version` | [string](#string) | | fee_version defines the ICS29 fee version | | `app_version` | [string](#string) | | app_version defines the underlying application version, which may or may not be a JSON encoded bytestring | diff --git a/modules/apps/29-fee/fee_test.go b/modules/apps/29-fee/fee_test.go index c8b57cb7792..e7fe0c371af 100644 --- a/modules/apps/29-fee/fee_test.go +++ b/modules/apps/29-fee/fee_test.go @@ -30,7 +30,7 @@ func (suite *FeeTestSuite) SetupTest() { suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1)) path := ibctesting.NewPath(suite.chainA, suite.chainB) - feeTransferVersion := string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: transfertypes.Version})) + feeTransferVersion := string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: transfertypes.Version})) path.EndpointA.ChannelConfig.Version = feeTransferVersion path.EndpointB.ChannelConfig.Version = feeTransferVersion path.EndpointA.ChannelConfig.PortID = transfertypes.PortID diff --git a/modules/apps/29-fee/ibc_module.go b/modules/apps/29-fee/ibc_module.go index e1a8870c1a3..cb5eb71b6d3 100644 --- a/modules/apps/29-fee/ibc_module.go +++ b/modules/apps/29-fee/ibc_module.go @@ -46,8 +46,8 @@ func (im IBCModule) OnChanOpenInit( chanCap, counterparty, version) } - if versionMetadata.Version != types.Version { - return sdkerrors.Wrapf(types.ErrInvalidVersion, "expected %s, got %s", types.Version, versionMetadata.Version) + if versionMetadata.FeeVersion != types.Version { + return sdkerrors.Wrapf(types.ErrInvalidVersion, "expected %s, got %s", types.Version, versionMetadata.FeeVersion) } im.keeper.SetFeeEnabled(ctx, portID, channelID) @@ -78,8 +78,8 @@ func (im IBCModule) OnChanOpenTry( return im.app.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, counterpartyVersion) } - if versionMetadata.Version != types.Version { - return "", sdkerrors.Wrapf(types.ErrInvalidVersion, "expected %s, got %s", types.Version, versionMetadata.Version) + if versionMetadata.FeeVersion != types.Version { + return "", sdkerrors.Wrapf(types.ErrInvalidVersion, "expected %s, got %s", types.Version, versionMetadata.FeeVersion) } im.keeper.SetFeeEnabled(ctx, portID, channelID) @@ -115,8 +115,8 @@ func (im IBCModule) OnChanOpenAck( return sdkerrors.Wrap(types.ErrInvalidVersion, "failed to unmarshal ICS29 counterparty version metadata") } - if versionMetadata.Version != types.Version { - return sdkerrors.Wrapf(types.ErrInvalidVersion, "expected counterparty version: %s, got: %s", types.Version, versionMetadata.Version) + if versionMetadata.FeeVersion != types.Version { + return sdkerrors.Wrapf(types.ErrInvalidVersion, "expected counterparty version: %s, got: %s", types.Version, versionMetadata.FeeVersion) } // call underlying app's OnChanOpenAck callback with the counterparty app version. diff --git a/modules/apps/29-fee/ibc_module_test.go b/modules/apps/29-fee/ibc_module_test.go index 5691cd2083d..5c4b198efb3 100644 --- a/modules/apps/29-fee/ibc_module_test.go +++ b/modules/apps/29-fee/ibc_module_test.go @@ -27,7 +27,7 @@ func (suite *FeeTestSuite) TestOnChanOpenInit() { }{ { "success - valid fee middleware and transfer version", - string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: transfertypes.Version})), + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: transfertypes.Version})), true, }, { @@ -37,12 +37,12 @@ func (suite *FeeTestSuite) TestOnChanOpenInit() { }, { "invalid fee middleware version", - string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: "invalid-ics29-1", AppVersion: transfertypes.Version})), + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: "invalid-ics29-1", AppVersion: transfertypes.Version})), false, }, { "invalid transfer version", - string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: "invalid-ics20-1"})), + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: "invalid-ics20-1"})), false, }, { @@ -101,7 +101,7 @@ func (suite *FeeTestSuite) TestOnChanOpenTry() { }{ { "success - valid fee middleware version", - string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: transfertypes.Version})), + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: transfertypes.Version})), false, true, }, @@ -113,19 +113,19 @@ func (suite *FeeTestSuite) TestOnChanOpenTry() { }, { "success - crossing hellos: valid fee middleware", - string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: transfertypes.Version})), + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: transfertypes.Version})), true, true, }, { "invalid fee middleware version", - string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: "invalid-ics29-1", AppVersion: transfertypes.Version})), + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: "invalid-ics29-1", AppVersion: transfertypes.Version})), false, false, }, { "invalid transfer version", - string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: "invalid-ics20-1"})), + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: "invalid-ics20-1"})), false, false, }, @@ -193,19 +193,19 @@ func (suite *FeeTestSuite) TestOnChanOpenAck() { }{ { "success", - string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: transfertypes.Version})), + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: transfertypes.Version})), func(suite *FeeTestSuite) {}, true, }, { "invalid fee version", - string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: "invalid-ics29-1", AppVersion: transfertypes.Version})), + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: "invalid-ics29-1", AppVersion: transfertypes.Version})), func(suite *FeeTestSuite) {}, false, }, { "invalid transfer version", - string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: "invalid-ics20-1"})), + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: "invalid-ics20-1"})), func(suite *FeeTestSuite) {}, false, }, @@ -217,7 +217,7 @@ func (suite *FeeTestSuite) TestOnChanOpenAck() { }, { "previous INIT set without fee, however counterparty set fee version", // note this can only happen with incompetent or malicious counterparty chain - string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: transfertypes.Version})), + string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: transfertypes.Version})), func(suite *FeeTestSuite) { // do the first steps without fee version, then pass the fee version as counterparty version in ChanOpenACK suite.path.EndpointA.ChannelConfig.Version = transfertypes.Version diff --git a/modules/apps/29-fee/keeper/keeper_test.go b/modules/apps/29-fee/keeper/keeper_test.go index e84ea4d53dd..577d0e8b5f4 100644 --- a/modules/apps/29-fee/keeper/keeper_test.go +++ b/modules/apps/29-fee/keeper/keeper_test.go @@ -40,7 +40,7 @@ func (suite *KeeperTestSuite) SetupTest() { suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1)) path := ibctesting.NewPath(suite.chainA, suite.chainB) - feeTransferVersion := string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{Version: types.Version, AppVersion: transfertypes.Version})) + feeTransferVersion := string(types.ModuleCdc.MustMarshalJSON(&types.Metadata{FeeVersion: types.Version, AppVersion: transfertypes.Version})) path.EndpointA.ChannelConfig.Version = feeTransferVersion path.EndpointB.ChannelConfig.Version = feeTransferVersion path.EndpointA.ChannelConfig.PortID = transfertypes.PortID diff --git a/modules/apps/29-fee/types/metadata.pb.go b/modules/apps/29-fee/types/metadata.pb.go index 14a1f4ae570..95bb9244946 100644 --- a/modules/apps/29-fee/types/metadata.pb.go +++ b/modules/apps/29-fee/types/metadata.pb.go @@ -26,8 +26,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Metadata defines the ICS29 channel specific metadata encoded into the channel version bytestring // See ICS004: https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#Versioning type Metadata struct { - // version defines the ICS29 fee version - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // fee_version defines the ICS29 fee version + FeeVersion string `protobuf:"bytes,1,opt,name=fee_version,json=feeVersion,proto3" json:"fee_version,omitempty" yaml:"fee_version"` // app_version defines the underlying application version, which may or may not be a JSON encoded bytestring AppVersion string `protobuf:"bytes,2,opt,name=app_version,json=appVersion,proto3" json:"app_version,omitempty" yaml:"app_version"` } @@ -65,9 +65,9 @@ func (m *Metadata) XXX_DiscardUnknown() { var xxx_messageInfo_Metadata proto.InternalMessageInfo -func (m *Metadata) GetVersion() string { +func (m *Metadata) GetFeeVersion() string { if m != nil { - return m.Version + return m.FeeVersion } return "" } @@ -88,22 +88,23 @@ func init() { } var fileDescriptor_03d0f000eda681ce = []byte{ - // 239 bytes of a gzipped FileDescriptorProto + // 248 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcb, 0x4c, 0x4a, 0xd6, 0x4f, 0x2c, 0x28, 0xc8, 0xc9, 0x4c, 0x4e, 0x2c, 0xc9, 0xcc, 0xcf, 0x2b, 0xd6, 0x4f, 0x4b, 0x4d, 0xd5, 0x2f, 0x33, 0xd4, 0xcf, 0x4d, 0x2d, 0x49, 0x4c, 0x49, 0x2c, 0x49, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xcf, 0x4c, 0x4a, 0xd6, 0x43, 0x56, 0xa7, 0x97, 0x96, 0x9a, 0xaa, 0x57, - 0x66, 0x28, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa3, 0x0f, 0x62, 0x41, 0x94, 0x2b, 0xc5, - 0x72, 0x71, 0xf8, 0x42, 0x0d, 0x10, 0x92, 0xe0, 0x62, 0x2f, 0x4b, 0x2d, 0x2a, 0xce, 0xcc, 0xcf, - 0x93, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x82, 0x71, 0x85, 0xcc, 0xb9, 0xb8, 0x13, 0x0b, 0x0a, - 0xe2, 0x61, 0xb2, 0x4c, 0x20, 0x59, 0x27, 0xb1, 0x4f, 0xf7, 0xe4, 0x85, 0x2a, 0x13, 0x73, 0x73, - 0xac, 0x94, 0x90, 0x24, 0x95, 0x82, 0xb8, 0x12, 0x0b, 0x0a, 0xc2, 0x20, 0x1c, 0x27, 0xff, 0x13, - 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, - 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, - 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0xcf, 0x4c, 0x4a, 0xd6, - 0x4d, 0xcf, 0xd7, 0x2f, 0x33, 0xd6, 0xcf, 0xcd, 0x4f, 0x29, 0xcd, 0x49, 0x2d, 0x06, 0xf9, 0xb7, - 0x58, 0xdf, 0xc8, 0x52, 0x17, 0xe4, 0xd5, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0xb3, - 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3d, 0x6f, 0x79, 0x1f, 0x0f, 0x01, 0x00, 0x00, + 0x66, 0x28, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa3, 0x0f, 0x62, 0x41, 0x94, 0x2b, 0xd5, + 0x70, 0x71, 0xf8, 0x42, 0x0d, 0x10, 0x32, 0xe7, 0xe2, 0x4e, 0x4b, 0x4d, 0x8d, 0x2f, 0x4b, 0x2d, + 0x2a, 0xce, 0xcc, 0xcf, 0x93, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x74, 0x12, 0xfb, 0x74, 0x4f, 0x5e, + 0xa8, 0x32, 0x31, 0x37, 0xc7, 0x4a, 0x09, 0x49, 0x52, 0x29, 0x88, 0x2b, 0x2d, 0x35, 0x35, 0x0c, + 0xc2, 0x01, 0x69, 0x4c, 0x2c, 0x28, 0x80, 0x6b, 0x64, 0x42, 0xd7, 0x88, 0x24, 0xa9, 0x14, 0xc4, + 0x95, 0x58, 0x50, 0x00, 0xd5, 0xe8, 0xe4, 0x7f, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, + 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, + 0x0c, 0x51, 0xa6, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xc9, 0xf9, + 0xc5, 0xb9, 0xf9, 0xc5, 0xfa, 0x99, 0x49, 0xc9, 0xba, 0xe9, 0xf9, 0xfa, 0x65, 0xc6, 0xfa, 0xb9, + 0xf9, 0x29, 0xa5, 0x39, 0xa9, 0xc5, 0xa0, 0xe0, 0x28, 0xd6, 0x37, 0xb2, 0xd4, 0x05, 0x85, 0x44, + 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x57, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x04, 0x84, 0x58, 0xe0, 0x2e, 0x01, 0x00, 0x00, } func (m *Metadata) Marshal() (dAtA []byte, err error) { @@ -133,10 +134,10 @@ func (m *Metadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.Version) > 0 { - i -= len(m.Version) - copy(dAtA[i:], m.Version) - i = encodeVarintMetadata(dAtA, i, uint64(len(m.Version))) + if len(m.FeeVersion) > 0 { + i -= len(m.FeeVersion) + copy(dAtA[i:], m.FeeVersion) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.FeeVersion))) i-- dAtA[i] = 0xa } @@ -160,7 +161,7 @@ func (m *Metadata) Size() (n int) { } var l int _ = l - l = len(m.Version) + l = len(m.FeeVersion) if l > 0 { n += 1 + l + sovMetadata(uint64(l)) } @@ -208,7 +209,7 @@ func (m *Metadata) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FeeVersion", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -236,7 +237,7 @@ func (m *Metadata) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Version = string(dAtA[iNdEx:postIndex]) + m.FeeVersion = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { diff --git a/proto/ibc/applications/fee/v1/metadata.proto b/proto/ibc/applications/fee/v1/metadata.proto index d2413664415..0afb3e09b2e 100644 --- a/proto/ibc/applications/fee/v1/metadata.proto +++ b/proto/ibc/applications/fee/v1/metadata.proto @@ -9,8 +9,8 @@ import "gogoproto/gogo.proto"; // Metadata defines the ICS29 channel specific metadata encoded into the channel version bytestring // See ICS004: https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#Versioning message Metadata { - // version defines the ICS29 fee version - string version = 1; + // fee_version defines the ICS29 fee version + string fee_version = 1 [(gogoproto.moretags) = "yaml:\"fee_version\""]; // app_version defines the underlying application version, which may or may not be a JSON encoded bytestring string app_version = 2 [(gogoproto.moretags) = "yaml:\"app_version\""]; }