diff --git a/CHANGELOG.md b/CHANGELOG.md index 54929b8e468..0e9a76846a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,8 +66,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (apps/transfer) [\#6440](https://github.com/cosmos/ibc-go/pull/6440) Remove `GetPrefixedDenom`. * (apps/transfer) [\#6508](https://github.com/cosmos/ibc-go/pull/6508) Remove the `DenomTrace` type. * (apps/27-interchain-accounts) [\#6598](https://github.com/cosmos/ibc-go/pull/6598) Mark the `requests` repeated field of `MsgModuleQuerySafe` non-nullable. -* (23-commmitment) [\#6644](https://github.com/cosmos/ibc-go/pull/6644) Introduce commitment/v2 `MerklePath` to include `repeated bytes` in favour of `repeated string`. This supports using merkle path keys which include non UTF-8 encoded runes. -* (23-commmitment) [\#6633](https://github.com/cosmos/ibc-go/pull/6633) MerklePath has been changed to use `repeated bytes` in favour of `repeated strings`. +* (23-commmitment) [\#6644](https://github.com/cosmos/ibc-go/pull/6644) Introduce `commitment.v2.MerklePath` to include `repeated bytes` in favour of `repeated string`. This supports using merkle path keys which include non UTF-8 encoded runes. +* (23-commmitment) [\#6870](https://github.com/cosmos/ibc-go/pull/6870) Remove `commitment.v1.MerklePath` in favour of `commitment.v2.MerklePath`. * (apps/27-interchain-accounts) [\#6749](https://github.com/cosmos/ibc-go/pull/6749) The ICA controller `NewIBCMiddleware` constructor function sets by default the auth module to nil. * (core, core/02-client) [\#6763](https://github.com/cosmos/ibc-go/pull/6763) Move prometheus metric labels for 02-client and core into a separate `metrics` package on core. * (core/02-client) [\#6777](https://github.com/cosmos/ibc-go/pull/6777) The `NewClientProposalHandler` of `02-client` has been removed. diff --git a/docs/client/swagger-ui/swagger.yaml b/docs/client/swagger-ui/swagger.yaml index 96bfc103015..1ae230cad24 100644 --- a/docs/client/swagger-ui/swagger.yaml +++ b/docs/client/swagger-ui/swagger.yaml @@ -105,207 +105,6 @@ paths: type: string tags: - Query - /ibc/apps/transfer/v1/denom_traces: - get: - summary: DenomTraces queries all denomination traces. - operationId: DenomTraces - responses: - '200': - description: A successful response. - schema: - type: object - properties: - denom_traces: - type: array - items: - type: object - properties: - path: - type: string - description: >- - path defines the chain of port/channel identifiers used - for tracing the - - source of the fungible token. - base_denom: - type: string - description: base denomination of the relayed fungible token. - description: >- - DenomTrace contains the base denomination for ICS20 fungible - tokens and the - - source tracing information path. - description: denom_traces returns all denominations trace information. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryConnectionsResponse is the response type for the - Query/DenomTraces RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /ibc/apps/transfer/v1/denom_traces/{hash}: - get: - summary: DenomTrace queries a denomination trace information. - operationId: DenomTrace - responses: - '200': - description: A successful response. - schema: - type: object - properties: - denom_trace: - type: object - properties: - path: - type: string - description: >- - path defines the chain of port/channel identifiers used - for tracing the - - source of the fungible token. - base_denom: - type: string - description: base denomination of the relayed fungible token. - description: >- - DenomTrace contains the base denomination for ICS20 fungible - tokens and the - - source tracing information path. - description: >- - QueryDenomTraceResponse is the response type for the - Query/DenomTrace RPC - - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - type_url: - type: string - value: - type: string - format: byte - parameters: - - name: hash - description: >- - hash (in hex format) or denom (full denom with ibc prefix) of the - denomination trace information. - in: path - required: true - type: string - tags: - - Query /ibc/apps/transfer/v1/denoms/{denom}/total_escrow: get: summary: >- @@ -929,8 +728,10 @@ paths: was set, its value is undefined otherwise title: >- - QueryIncentivizedPacketsResponse defines the response type for the - incentivized packets RPC + QueryIncentivizedPacketsForChannelResponse defines the response + type for querying for all incentivized packets + + for a specific channel default: description: An unexpected error response. schema: @@ -1763,7 +1564,7 @@ paths: IdentifiedPacketFees contains a list of type PacketFee and associated PacketId title: >- - QueryIncentivizedPacketsResponse defines the response type for the + QueryIncentivizedPacketResponse defines the response type for the IncentivizedPacket rpc default: description: An unexpected error response. @@ -7157,6 +6958,18 @@ paths: of updating and freezing clients + value: + type: string + format: byte + description: the value which is proven. + time_delay: + type: string + format: uint64 + title: optional time delay + block_delay: + type: string + format: uint64 + title: optional block delay merkle_path: description: the commitment key path. type: object @@ -7165,6 +6978,7 @@ paths: type: array items: type: string + format: byte title: >- MerklePath is the path used to verify commitment proofs, which can be an @@ -7172,18 +6986,6 @@ paths: arbitrary structured object (defined by a commitment type). MerklePath is represented from root-to-leaf - value: - type: string - format: byte - description: the value which is proven. - time_delay: - type: string - format: uint64 - title: optional time delay - block_delay: - type: string - format: uint64 - title: optional block delay title: >- QueryVerifyMembershipRequest is the request type for the Query/VerifyMembership RPC method @@ -15045,83 +14847,6 @@ paths: tags: - Query definitions: - cosmos.base.query.v1beta1.PageRequest: - type: object - properties: - key: - type: string - format: byte - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - offset: - type: string - format: uint64 - description: |- - offset is a numeric offset that can be used when key is unavailable. - It is less efficient than using key. Only one of offset or key should - be set. - limit: - type: string - format: uint64 - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - count_total: - type: boolean - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in UIs. - - count_total is only respected when offset is used. It is ignored when - key - - is set. - reverse: - type: boolean - description: >- - reverse is set to true if results are to be returned in the descending - order. - - - Since: cosmos-sdk 0.43 - description: |- - message SomeRequest { - Foo some_parameter = 1; - PageRequest pagination = 2; - } - title: |- - PageRequest is to be embedded in gRPC request messages for efficient - pagination. Ex: - cosmos.base.query.v1beta1.PageResponse: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: |- - total is total number of results available if PageRequest.count_total - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } cosmos.base.v1beta1.Coin: type: object properties: @@ -15473,24 +15198,6 @@ definitions: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } - ibc.applications.transfer.v1.DenomTrace: - type: object - properties: - path: - type: string - description: >- - path defines the chain of port/channel identifiers used for tracing - the - - source of the fungible token. - base_denom: - type: string - description: base denomination of the relayed fungible token. - description: >- - DenomTrace contains the base denomination for ICS20 fungible tokens and - the - - source tracing information path. ibc.applications.transfer.v1.Params: type: object properties: @@ -15525,78 +15232,6 @@ definitions: description: hash (in hex format) of the denomination trace information. description: |- QueryDenomHashResponse is the response type for the Query/DenomHash RPC - method. - ibc.applications.transfer.v1.QueryDenomTraceResponse: - type: object - properties: - denom_trace: - type: object - properties: - path: - type: string - description: >- - path defines the chain of port/channel identifiers used for - tracing the - - source of the fungible token. - base_denom: - type: string - description: base denomination of the relayed fungible token. - description: >- - DenomTrace contains the base denomination for ICS20 fungible tokens - and the - - source tracing information path. - description: |- - QueryDenomTraceResponse is the response type for the Query/DenomTrace RPC - method. - ibc.applications.transfer.v1.QueryDenomTracesResponse: - type: object - properties: - denom_traces: - type: array - items: - type: object - properties: - path: - type: string - description: >- - path defines the chain of port/channel identifiers used for - tracing the - - source of the fungible token. - base_denom: - type: string - description: base denomination of the relayed fungible token. - description: >- - DenomTrace contains the base denomination for ICS20 fungible tokens - and the - - source tracing information path. - description: denom_traces returns all denominations trace information. - pagination: - description: pagination defines the pagination in the response. - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - QueryConnectionsResponse is the response type for the Query/DenomTraces - RPC - method. ibc.applications.transfer.v1.QueryEscrowAddressResponse: type: object @@ -15709,6 +15344,83 @@ definitions: allow_messages defines a list of sdk message typeURLs allowed to be executed on a host chain. description: QueryParamsResponse is the response type for the Query/Params RPC method. + cosmos.base.query.v1beta1.PageRequest: + type: object + properties: + key: + type: string + format: byte + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + offset: + type: string + format: uint64 + description: |- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key should + be set. + limit: + type: string + format: uint64 + description: >- + limit is the total number of results to be returned in the result + page. + + If left empty it will default to a value to be set by each app. + count_total: + type: boolean + description: >- + count_total is set to true to indicate that the result set should + include + + a count of the total number of items available for pagination in UIs. + + count_total is only respected when offset is used. It is ignored when + key + + is set. + reverse: + type: boolean + description: >- + reverse is set to true if results are to be returned in the descending + order. + + + Since: cosmos-sdk 0.43 + description: |- + message SomeRequest { + Foo some_parameter = 1; + PageRequest pagination = 2; + } + title: |- + PageRequest is to be embedded in gRPC request messages for efficient + pagination. Ex: + cosmos.base.query.v1beta1.PageResponse: + type: object + properties: + next_key: + type: string + format: byte + description: |- + next_key is the key to be passed to PageRequest.key to + query the next page most efficiently. It will be empty if + there are no more results. + total: + type: string + format: uint64 + title: |- + total is total number of results available if PageRequest.count_total + was set, its value is undefined otherwise + description: |- + PageResponse is to be embedded in gRPC response messages where the + corresponding request message has used PageRequest. + + message SomeResponse { + repeated Bar results = 1; + PageResponse page = 2; + } ibc.applications.fee.v1.Fee: type: object properties: @@ -16107,7 +15819,7 @@ definitions: IdentifiedPacketFees contains a list of type PacketFee and associated PacketId title: >- - QueryIncentivizedPacketsResponse defines the response type for the + QueryIncentivizedPacketResponse defines the response type for the IncentivizedPacket rpc ibc.applications.fee.v1.QueryIncentivizedPacketsForChannelResponse: type: object @@ -16237,8 +15949,10 @@ definitions: was set, its value is undefined otherwise title: >- - QueryIncentivizedPacketsResponse defines the response type for the - incentivized packets RPC + QueryIncentivizedPacketsForChannelResponse defines the response type for + querying for all incentivized packets + + for a specific channel ibc.applications.fee.v1.QueryIncentivizedPacketsResponse: type: object properties: @@ -18256,6 +17970,18 @@ definitions: updating and freezing clients + value: + type: string + format: byte + description: the value which is proven. + time_delay: + type: string + format: uint64 + title: optional time delay + block_delay: + type: string + format: uint64 + title: optional block delay merkle_path: description: the commitment key path. type: object @@ -18264,6 +17990,7 @@ definitions: type: array items: type: string + format: byte title: >- MerklePath is the path used to verify commitment proofs, which can be an @@ -18271,18 +17998,6 @@ definitions: arbitrary structured object (defined by a commitment type). MerklePath is represented from root-to-leaf - value: - type: string - format: byte - description: the value which is proven. - time_delay: - type: string - format: uint64 - title: optional time delay - block_delay: - type: string - format: uint64 - title: optional block delay title: >- QueryVerifyMembershipRequest is the request type for the Query/VerifyMembership RPC method @@ -18295,13 +18010,14 @@ definitions: title: >- QueryVerifyMembershipResponse is the response type for the Query/VerifyMembership RPC method - ibc.core.commitment.v1.MerklePath: + ibc.core.commitment.v2.MerklePath: type: object properties: key_path: type: array items: type: string + format: byte title: |- MerklePath is the path used to verify commitment proofs, which can be an arbitrary structured object (defined by a commitment type). diff --git a/docs/docs/05-migrations/13-v8-to-v9.md b/docs/docs/05-migrations/13-v8-to-v9.md index 0e77dda94bb..1dc3e7c3dc6 100644 --- a/docs/docs/05-migrations/13-v8-to-v9.md +++ b/docs/docs/05-migrations/13-v8-to-v9.md @@ -193,6 +193,7 @@ type PacketDataUnmarshaler interface { - The [`exported.Proof`](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/exported/commitment.go#L34-L44) interface has been removed. Please use the [`MerkleProof`](https://github.com/cosmos/ibc-go/blob/release/v9.0.x/modules/core/23-commitment/types/commitment.pb.go#L161-L168) concrete type. - The [`MerklePath` type](https://github.com/cosmos/ibc-go/blob/release/v9.0.x/modules/core/23-commitment/types/commitment.pb.go#L113-L119) has been deprecated and a new [`commitment.v2.MerklePath` type](https://github.com/cosmos/ibc-go/blob/release/v9.0.x/modules/core/23-commitment/types/v2/commitment.pb.go#L25-L30) has been introduced in [#6644](https://github.com/cosmos/ibc-go/pull/6644). The new `commitment.v2.MerklePath` contains `repeated bytes` in favour of `repeated string`. This allows users to prove values stored under keys which contain non-utf8 encoded symbols. As a result, changes have been made to the 02-client `Query` service and 08-wasm contract API messages for JSON blobs. See [02-client](#02-client) and [08-wasm](#08-wasm), respectively. +- The `commitment.v1.MerklePath` type has been removed and a new `commitment.v2.MerklePath` type has been introduced in [#6644](https://github.com/cosmos/ibc-go/pull/6644). The new `commitment.v2.MerklePath` contains `repeated bytes` in favour of `repeated string`. This allows users to prove values stored under keys which contain non-utf8 encoded symbols. As a result, changes have been made to the 02-client `Query` service and 08-wasm contract API messages for JSON blobs. See [02-client](#02-client) and [08-wasm](#08-wasm), respectively. ## IBC Apps diff --git a/modules/core/23-commitment/types/codec.go b/modules/core/23-commitment/types/codec.go index bf72c2cbbdb..28a429d0f9f 100644 --- a/modules/core/23-commitment/types/codec.go +++ b/modules/core/23-commitment/types/codec.go @@ -3,6 +3,7 @@ package types import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types/v2" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) @@ -31,6 +32,6 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { ) registry.RegisterImplementations( (*exported.Path)(nil), - &MerklePath{}, + &v2.MerklePath{}, ) } diff --git a/modules/core/23-commitment/types/codec_test.go b/modules/core/23-commitment/types/codec_test.go index 1c7f48da47b..7ceab30a918 100644 --- a/modules/core/23-commitment/types/codec_test.go +++ b/modules/core/23-commitment/types/codec_test.go @@ -6,6 +6,7 @@ import ( ibc "github.com/cosmos/ibc-go/v9/modules/core" "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types" + "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types/v2" ) func (suite *MerkleTestSuite) TestCodecTypeRegistration() { @@ -26,7 +27,7 @@ func (suite *MerkleTestSuite) TestCodecTypeRegistration() { }, { "success: MerklePath", - sdk.MsgTypeURL(&types.MerklePath{}), + sdk.MsgTypeURL(&v2.MerklePath{}), true, }, { diff --git a/modules/core/23-commitment/types/commitment.pb.go b/modules/core/23-commitment/types/commitment.pb.go index f325e586439..293d56effed 100644 --- a/modules/core/23-commitment/types/commitment.pb.go +++ b/modules/core/23-commitment/types/commitment.pb.go @@ -110,54 +110,6 @@ func (m *MerklePrefix) GetKeyPrefix() []byte { return nil } -// MerklePath is the path used to verify commitment proofs, which can be an -// arbitrary structured object (defined by a commitment type). -// MerklePath is represented from root-to-leaf -// Deprecated: Please use commitment/v2 MerklePath instead which supports non UTF-8 key paths. -type MerklePath struct { - KeyPath []string `protobuf:"bytes,1,rep,name=key_path,json=keyPath,proto3" json:"key_path,omitempty"` -} - -func (m *MerklePath) Reset() { *m = MerklePath{} } -func (m *MerklePath) String() string { return proto.CompactTextString(m) } -func (*MerklePath) ProtoMessage() {} -func (*MerklePath) Descriptor() ([]byte, []int) { - return fileDescriptor_7921d88972a41469, []int{2} -} -func (m *MerklePath) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MerklePath) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MerklePath.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 *MerklePath) XXX_Merge(src proto.Message) { - xxx_messageInfo_MerklePath.Merge(m, src) -} -func (m *MerklePath) XXX_Size() int { - return m.Size() -} -func (m *MerklePath) XXX_DiscardUnknown() { - xxx_messageInfo_MerklePath.DiscardUnknown(m) -} - -var xxx_messageInfo_MerklePath proto.InternalMessageInfo - -func (m *MerklePath) GetKeyPath() []string { - if m != nil { - return m.KeyPath - } - return nil -} - // MerkleProof is a wrapper type over a chain of CommitmentProofs. // It demonstrates membership or non-membership for an element or set of // elements, verifiable in conjunction with a known commitment root. Proofs @@ -171,7 +123,7 @@ func (m *MerkleProof) Reset() { *m = MerkleProof{} } func (m *MerkleProof) String() string { return proto.CompactTextString(m) } func (*MerkleProof) ProtoMessage() {} func (*MerkleProof) Descriptor() ([]byte, []int) { - return fileDescriptor_7921d88972a41469, []int{3} + return fileDescriptor_7921d88972a41469, []int{2} } func (m *MerkleProof) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -210,7 +162,6 @@ func (m *MerkleProof) GetProofs() []*_go.CommitmentProof { func init() { proto.RegisterType((*MerkleRoot)(nil), "ibc.core.commitment.v1.MerkleRoot") proto.RegisterType((*MerklePrefix)(nil), "ibc.core.commitment.v1.MerklePrefix") - proto.RegisterType((*MerklePath)(nil), "ibc.core.commitment.v1.MerklePath") proto.RegisterType((*MerkleProof)(nil), "ibc.core.commitment.v1.MerkleProof") } @@ -219,27 +170,26 @@ func init() { } var fileDescriptor_7921d88972a41469 = []byte{ - // 312 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0xb1, 0x4e, 0xeb, 0x30, - 0x14, 0x86, 0x13, 0xdd, 0xaa, 0x97, 0xba, 0x9d, 0x2c, 0x84, 0xa0, 0x02, 0x53, 0x65, 0xa0, 0x5d, - 0x6a, 0xab, 0xed, 0x02, 0x88, 0x09, 0x06, 0x26, 0xa4, 0x2a, 0x03, 0x03, 0x0b, 0x4a, 0x8c, 0x9b, - 0x58, 0x6d, 0x38, 0x51, 0xec, 0x46, 0xf4, 0x0d, 0x18, 0x79, 0x04, 0x1e, 0x87, 0xb1, 0x23, 0x23, - 0x6a, 0x5e, 0x04, 0xd9, 0x6e, 0x50, 0xb6, 0x73, 0x74, 0x3e, 0xff, 0xfa, 0xfd, 0xa1, 0xa1, 0x8c, - 0x39, 0xe3, 0x50, 0x08, 0xc6, 0x21, 0xcb, 0xa4, 0xce, 0xc4, 0xab, 0x66, 0xe5, 0xa4, 0xb1, 0xd1, - 0xbc, 0x00, 0x0d, 0xf8, 0x48, 0xc6, 0x9c, 0x1a, 0x90, 0x36, 0x4e, 0xe5, 0xa4, 0x7f, 0x98, 0x40, - 0x02, 0x16, 0x61, 0x66, 0x72, 0x74, 0xff, 0x94, 0x83, 0xca, 0x40, 0x31, 0xc9, 0xd5, 0x74, 0x66, - 0xf2, 0xf2, 0x02, 0x60, 0xa1, 0xdc, 0x35, 0xb8, 0x40, 0xe8, 0x41, 0x14, 0xcb, 0x95, 0x08, 0x01, - 0x34, 0xc6, 0xa8, 0x95, 0x46, 0x2a, 0x3d, 0xf6, 0x07, 0xfe, 0xa8, 0x17, 0xda, 0xf9, 0xba, 0xf5, - 0xfe, 0x79, 0xee, 0x05, 0x63, 0xd4, 0x73, 0xdc, 0xbc, 0x10, 0x0b, 0xf9, 0x86, 0xcf, 0x10, 0x5a, - 0x8a, 0xcd, 0x73, 0x6e, 0xb7, 0x3d, 0xdf, 0x59, 0x8a, 0x8d, 0x3b, 0x07, 0xc3, 0x3a, 0x76, 0x1e, - 0xe9, 0x14, 0x9f, 0xa0, 0x03, 0x0b, 0x47, 0xda, 0x44, 0xff, 0x1b, 0x75, 0xc2, 0xff, 0x06, 0x8d, - 0x74, 0x1a, 0xdc, 0xa3, 0x6e, 0x9d, 0x0b, 0xb0, 0xc0, 0x97, 0xa8, 0xed, 0xea, 0x59, 0xae, 0x3b, - 0x1d, 0x50, 0xd7, 0x9e, 0xda, 0xf6, 0xb4, 0x9c, 0xd0, 0xbb, 0xbf, 0x2f, 0xdb, 0x17, 0xe1, 0x9e, - 0xbf, 0x7d, 0xfc, 0xda, 0x11, 0x7f, 0xbb, 0x23, 0xfe, 0xcf, 0x8e, 0xf8, 0x1f, 0x15, 0xf1, 0xb6, - 0x15, 0xf1, 0xbe, 0x2b, 0xe2, 0x3d, 0xdd, 0x24, 0x52, 0xa7, 0xeb, 0xd8, 0xc8, 0x62, 0xb5, 0x8b, - 0x98, 0x8f, 0x13, 0x60, 0xe5, 0x15, 0xcb, 0xe0, 0x65, 0xbd, 0x12, 0xca, 0x79, 0x9f, 0xce, 0xc6, - 0x0d, 0xf5, 0x7a, 0x93, 0x0b, 0x15, 0xb7, 0xad, 0xa7, 0xd9, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xbb, 0x86, 0x2e, 0x40, 0x9e, 0x01, 0x00, 0x00, + // 290 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcf, 0x4c, 0x4a, 0xd6, + 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0xce, 0xcf, 0xcd, 0xcd, 0x2c, 0xc9, 0x4d, 0xcd, 0x2b, 0xd1, + 0x2f, 0x33, 0x44, 0xe2, 0xe9, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0x89, 0x65, 0x26, 0x25, 0xeb, + 0x81, 0x14, 0xea, 0x21, 0x49, 0x95, 0x19, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x95, 0xe8, + 0x83, 0x58, 0x10, 0xd5, 0x52, 0x32, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xfa, 0x99, 0xc9, 0xc5, + 0x46, 0xc6, 0x20, 0xf3, 0x0a, 0x8a, 0xf2, 0xf3, 0xd3, 0x8a, 0x21, 0xb2, 0x4a, 0x6a, 0x5c, 0x5c, + 0xbe, 0xa9, 0x45, 0xd9, 0x39, 0xa9, 0x41, 0xf9, 0xf9, 0x25, 0x42, 0x42, 0x5c, 0x2c, 0x19, 0x89, + 0xc5, 0x19, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, 0x60, 0xb6, 0x15, 0x4b, 0xc7, 0x02, 0x79, + 0x06, 0x25, 0x5d, 0x2e, 0x1e, 0x88, 0xba, 0x80, 0xa2, 0xd4, 0xb4, 0xcc, 0x0a, 0x21, 0x59, 0x2e, + 0xae, 0xec, 0xd4, 0xca, 0xf8, 0x02, 0x30, 0x0f, 0xaa, 0x9e, 0x33, 0x3b, 0xb5, 0x12, 0x22, 0xad, + 0xe4, 0xce, 0xc5, 0x0d, 0x53, 0x9e, 0x9f, 0x9f, 0x26, 0x64, 0xc1, 0xc5, 0x06, 0xb1, 0x55, 0x82, + 0x51, 0x81, 0x59, 0x83, 0xdb, 0x48, 0x41, 0x0f, 0xe2, 0x28, 0x3d, 0xb0, 0xa3, 0xf4, 0xca, 0x0c, + 0xf5, 0x9c, 0xe1, 0x3e, 0x01, 0xeb, 0x08, 0x82, 0xaa, 0x77, 0x0a, 0x3b, 0xf1, 0x48, 0x8e, 0xf1, + 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, + 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x9b, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0x50, 0x18, 0xe8, + 0xc3, 0xbc, 0x98, 0x94, 0xac, 0x9b, 0x9e, 0xaf, 0x5f, 0x66, 0xa9, 0x9f, 0x9b, 0x9f, 0x52, 0x9a, + 0x93, 0x5a, 0x0c, 0x09, 0x4e, 0x23, 0x63, 0x5d, 0xa4, 0x10, 0x2d, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, + 0x62, 0x03, 0x7b, 0xdf, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xf5, 0x21, 0xe6, 0xb9, 0x75, 0x01, + 0x00, 0x00, } func (m *MerkleRoot) Marshal() (dAtA []byte, err error) { @@ -302,38 +252,6 @@ func (m *MerklePrefix) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MerklePath) 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 *MerklePath) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MerklePath) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.KeyPath) > 0 { - for iNdEx := len(m.KeyPath) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.KeyPath[iNdEx]) - copy(dAtA[i:], m.KeyPath[iNdEx]) - i = encodeVarintCommitment(dAtA, i, uint64(len(m.KeyPath[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - func (m *MerkleProof) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -408,21 +326,6 @@ func (m *MerklePrefix) Size() (n int) { return n } -func (m *MerklePath) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.KeyPath) > 0 { - for _, s := range m.KeyPath { - l = len(s) - n += 1 + l + sovCommitment(uint64(l)) - } - } - return n -} - func (m *MerkleProof) Size() (n int) { if m == nil { return 0 @@ -612,88 +515,6 @@ func (m *MerklePrefix) Unmarshal(dAtA []byte) error { } return nil } -func (m *MerklePath) 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 ErrIntOverflowCommitment - } - 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: MerklePath: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MerklePath: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field KeyPath", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCommitment - } - 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 ErrInvalidLengthCommitment - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCommitment - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.KeyPath = append(m.KeyPath, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCommitment(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCommitment - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *MerkleProof) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/modules/core/23-commitment/types/merkle.go b/modules/core/23-commitment/types/merkle.go index 58c849a66c7..a53452c43b3 100644 --- a/modules/core/23-commitment/types/merkle.go +++ b/modules/core/23-commitment/types/merkle.go @@ -2,7 +2,6 @@ package types import ( "bytes" - "fmt" "github.com/cosmos/gogoproto/proto" ics23 "github.com/cosmos/ics23/go" @@ -67,28 +66,11 @@ func (mp MerklePrefix) Empty() bool { return len(mp.Bytes()) == 0 } -var _ exported.Path = (*MerklePath)(nil) - // NewMerklePath creates a new MerklePath instance // The keys must be passed in from root-to-leaf order. // NOTE: NewMerklePath returns a commitment/v2 MerklePath. var NewMerklePath = v2.NewMerklePath -// GetKey will return a byte representation of the key -// Deprecated: Please use commitment/v2 MerklePath instead. -func (mp MerklePath) GetKey(i uint64) (string, error) { - if i >= uint64(len(mp.KeyPath)) { - return "", fmt.Errorf("index out of range. %d (index) >= %d (len)", i, len(mp.KeyPath)) - } - return mp.KeyPath[i], nil -} - -// Empty returns true if the path is empty -// Deprecated: Please use commitment/v2 MerklePath instead. -func (mp MerklePath) Empty() bool { - return len(mp.KeyPath) == 0 -} - // ApplyPrefix constructs a new commitment path from the arguments. It prepends the prefix key // with the given path. func ApplyPrefix(prefix exported.Prefix, path v2.MerklePath) (v2.MerklePath, error) { diff --git a/modules/light-clients/06-solomachine/misbehaviour_handle.go b/modules/light-clients/06-solomachine/misbehaviour_handle.go index b6bb1323399..0b38a4cbc88 100644 --- a/modules/light-clients/06-solomachine/misbehaviour_handle.go +++ b/modules/light-clients/06-solomachine/misbehaviour_handle.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - commitmenttypes "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types" + commitmenttypesv2 "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types/v2" "github.com/cosmos/ibc-go/v9/modules/core/exported" ) @@ -41,7 +41,7 @@ func (cs ClientState) verifyMisbehaviour(cdc codec.BinaryCodec, misbehaviour *Mi // unmarshaled into the specified data type. func (cs ClientState) verifySignatureAndData(cdc codec.BinaryCodec, misbehaviour *Misbehaviour, sigAndData *SignatureAndData) error { // do not check misbehaviour timestamp since we want to allow processing of past misbehaviour - if err := cdc.Unmarshal(sigAndData.Path, new(commitmenttypes.MerklePath)); err != nil { + if err := cdc.Unmarshal(sigAndData.Path, new(commitmenttypesv2.MerklePath)); err != nil { return err } diff --git a/modules/light-clients/09-localhost/light_client_module.go b/modules/light-clients/09-localhost/light_client_module.go index 78eb4f1916a..3095503d985 100644 --- a/modules/light-clients/09-localhost/light_client_module.go +++ b/modules/light-clients/09-localhost/light_client_module.go @@ -91,7 +91,7 @@ func (l LightClientModule) VerifyMembership( merklePath, ok := path.(commitmenttypesv2.MerklePath) if !ok { - return errorsmod.Wrapf(ibcerrors.ErrInvalidType, "expected %T, got %T", commitmenttypes.MerklePath{}, path) + return errorsmod.Wrapf(ibcerrors.ErrInvalidType, "expected %T, got %T", commitmenttypesv2.MerklePath{}, path) } if len(merklePath.GetKeyPath()) != 2 { @@ -132,7 +132,7 @@ func (l LightClientModule) VerifyNonMembership( merklePath, ok := path.(commitmenttypesv2.MerklePath) if !ok { - return errorsmod.Wrapf(ibcerrors.ErrInvalidType, "expected %T, got %T", commitmenttypes.MerklePath{}, path) + return errorsmod.Wrapf(ibcerrors.ErrInvalidType, "expected %T, got %T", commitmenttypesv2.MerklePath{}, path) } if len(merklePath.GetKeyPath()) != 2 { diff --git a/proto/ibc/core/commitment/v1/commitment.proto b/proto/ibc/core/commitment/v1/commitment.proto index f0b258c4ff7..d3431f71ab1 100644 --- a/proto/ibc/core/commitment/v1/commitment.proto +++ b/proto/ibc/core/commitment/v1/commitment.proto @@ -22,14 +22,6 @@ message MerklePrefix { bytes key_prefix = 1; } -// MerklePath is the path used to verify commitment proofs, which can be an -// arbitrary structured object (defined by a commitment type). -// MerklePath is represented from root-to-leaf -// Deprecated: Please use commitment/v2 MerklePath instead which supports non UTF-8 key paths. -message MerklePath { - repeated string key_path = 1; -} - // MerkleProof is a wrapper type over a chain of CommitmentProofs. // It demonstrates membership or non-membership for an element or set of // elements, verifiable in conjunction with a known commitment root. Proofs