From ed9bf74c1b3adacbac82a5f950b1abad7c6fbf52 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Thu, 15 Feb 2024 13:32:01 +0100 Subject: [PATCH] feat: add rpc `VerifyMembershipProof` - querier approach for conditional clients (#5821) * feat: adding protobuf msgs and rpc for VerifyMembershipProof * feat: adding VerifyMembershipProof query implementation and wiring * chore(08-wasm): add VerifyMembershipProof to stargate query acceptlist * test: adding failure case unit tests for VerifyMembershipProof query * fix: correct protodoc * chore: proto-swagger-gen * chore: protodocs * test: adding additional test cases * test: assert gas consumed in tests * chore: rename rpc to VerifyMembership and update tests * chore: update service definition URL in 08-wasm stargate accepted queries * test: adding verify membership test to 08-wasm querier * Update proto/ibc/core/client/v1/query.proto Co-authored-by: Carlos Rodriguez * chore: review items - log error at debug, pass cachedCtx and adjust tests for discarded state checks * chore: add doc comment to querier test, address nit to move defaultAcceptList * chore: regen protos and swagger doc * nit: update comment in querier * imp: add more info to godoc for VerifyMembership rpc --------- Co-authored-by: Carlos Rodriguez Co-authored-by: Cian Hatton --- docs/client/swagger-ui/swagger.yaml | 387 +++++++++ modules/core/02-client/keeper/grpc_query.go | 54 ++ .../core/02-client/keeper/grpc_query_test.go | 144 ++++ modules/core/02-client/types/query.pb.go | 807 ++++++++++++++++-- modules/core/02-client/types/query.pb.gw.go | 81 ++ modules/core/keeper/grpc_query.go | 5 + .../light-clients/08-wasm/types/querier.go | 9 +- .../08-wasm/types/querier_test.go | 106 ++- proto/ibc/core/client/v1/query.proto | 35 + 9 files changed, 1556 insertions(+), 72 deletions(-) diff --git a/docs/client/swagger-ui/swagger.yaml b/docs/client/swagger-ui/swagger.yaml index 60a43a59c7d..96bfc103015 100644 --- a/docs/client/swagger-ui/swagger.yaml +++ b/docs/client/swagger-ui/swagger.yaml @@ -6896,6 +6896,299 @@ paths: } tags: - Query + /ibc/core/client/v1/verify_membership: + post: + summary: >- + VerifyMembership queries an IBC light client for proof verification of a + value at a given key path. + operationId: VerifyMembership + responses: + '200': + description: A successful response. + schema: + type: object + properties: + success: + type: boolean + description: boolean indicating success or failure of proof verification. + title: >- + QueryVerifyMembershipResponse is the response type for the + Query/VerifyMembership 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 + description: >- + A URL/resource name that uniquely identifies the type of + the serialized + + protocol buffer message. This string must contain at + least + + one "/" character. The last segment of the URL's path + must represent + + the fully qualified name of the type (as in + + `path/google.protobuf.Duration`). The name should be in + a canonical form + + (e.g., leading "." is not accepted). + + + In practice, teams usually precompile into the binary + all types that they + + expect it to use in the context of Any. However, for + URLs which use the + + scheme `http`, `https`, or no scheme, one can optionally + set up a type + + server that maps type URLs to message definitions as + follows: + + + * If no scheme is provided, `https` is assumed. + + * An HTTP GET on the URL must yield a + [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based + on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in + the official + + protobuf release, and it is not used for type URLs + beginning with + + type.googleapis.com. + + + Schemes other than `http`, `https` (or the empty scheme) + might be + + used with implementation specific semantics. + value: + type: string + format: byte + description: >- + Must be a valid serialized protocol buffer of the above + specified type. + description: >- + `Any` contains an arbitrary serialized protocol buffer + message along with a + + URL that describes the type of the serialized message. + + + Protobuf library provides support to pack/unpack Any values + in the form + + of utility functions or additional generated methods of the + Any type. + + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by + default use + + 'type.googleapis.com/full.type.name' as the type URL and the + unpack + + methods only use the fully qualified type name after the + last '/' + + in the type URL, for example "foo.bar.com/x/y.z" will yield + type + + name "y.z". + + + JSON + + + The JSON representation of an `Any` value uses the regular + + representation of the deserialized, embedded message, with + an + + additional field `@type` which contains the type URL. + Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom + JSON + + representation, that representation will be embedded adding + a field + + `value` which holds the custom JSON in addition to the + `@type` + + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + client_id: + type: string + description: client unique identifier. + proof: + type: string + format: byte + description: the proof to be verified by the client. + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height + while keeping + + RevisionNumber the same. However some consensus algorithms may + choose to + + reset the height in certain conditions e.g. hard forks, + state-machine + + breaking changes In these cases, the RevisionNumber is + incremented so that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes + of updating and + + freezing clients + merkle_path: + description: the commitment key path. + type: object + properties: + key_path: + type: array + items: + type: string + title: >- + 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 + 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 + tags: + - Query /ibc/core/connection/v1/client_connections/{client_id}: get: summary: |- @@ -17919,6 +18212,100 @@ definitions: description: |- QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState RPC method. + ibc.core.client.v1.QueryVerifyMembershipRequest: + type: object + properties: + client_id: + type: string + description: client unique identifier. + proof: + type: string + format: byte + description: the proof to be verified by the client. + proof_height: + type: object + properties: + revision_number: + type: string + format: uint64 + title: the revision that the client is currently on + revision_height: + type: string + format: uint64 + title: the height within the given revision + description: >- + Normally the RevisionHeight is incremented at each height while + keeping + + RevisionNumber the same. However some consensus algorithms may choose + to + + reset the height in certain conditions e.g. hard forks, state-machine + + breaking changes In these cases, the RevisionNumber is incremented so + that + + height continues to be monitonically increasing even as the + RevisionHeight + + gets reset + title: >- + Height is a monotonically increasing data type + + that can be compared against another Height for the purposes of + updating and + + freezing clients + merkle_path: + description: the commitment key path. + type: object + properties: + key_path: + type: array + items: + type: string + title: >- + 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 + 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 + ibc.core.client.v1.QueryVerifyMembershipResponse: + type: object + properties: + success: + type: boolean + description: boolean indicating success or failure of proof verification. + title: >- + QueryVerifyMembershipResponse is the response type for the + Query/VerifyMembership RPC method + ibc.core.commitment.v1.MerklePath: + type: object + properties: + key_path: + type: array + items: + type: string + title: |- + 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 ibc.core.commitment.v1.MerklePrefix: type: object properties: diff --git a/modules/core/02-client/keeper/grpc_query.go b/modules/core/02-client/keeper/grpc_query.go index 12daed284c7..cf2714b329e 100644 --- a/modules/core/02-client/keeper/grpc_query.go +++ b/modules/core/02-client/keeper/grpc_query.go @@ -328,3 +328,57 @@ func (k Keeper) UpgradedConsensusState(c context.Context, req *types.QueryUpgrad UpgradedConsensusState: protoAny, }, nil } + +// VerifyMembership implements the Query/VerifyMembership gRPC method +// NOTE: Any state changes made within this handler are discarded by leveraging a cached context. Gas is consumed for underlying state access. +// This gRPC method is intended to be used within the context of the state machine and delegates to light clients to verify proofs. +func (k Keeper) VerifyMembership(c context.Context, req *types.QueryVerifyMembershipRequest) (*types.QueryVerifyMembershipResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if err := host.ClientIdentifierValidator(req.ClientId); err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + if len(req.Proof) == 0 { + return nil, status.Error(codes.InvalidArgument, "empty proof") + } + + if req.ProofHeight.IsZero() { + return nil, status.Error(codes.InvalidArgument, "proof height must be non-zero") + } + + if req.MerklePath.Empty() { + return nil, status.Error(codes.InvalidArgument, "empty merkle path") + } + + if len(req.Value) == 0 { + return nil, status.Error(codes.InvalidArgument, "empty value") + } + + ctx := sdk.UnwrapSDKContext(c) + // cache the context to ensure clientState.VerifyMembership does not change state + cachedCtx, _ := ctx.CacheContext() + + // make sure we charge the higher level context even on panic + defer func() { + ctx.GasMeter().ConsumeGas(cachedCtx.GasMeter().GasConsumed(), "verify membership query") + }() + + clientState, found := k.GetClientState(cachedCtx, req.ClientId) + if !found { + return nil, status.Error(codes.NotFound, errorsmod.Wrap(types.ErrClientNotFound, req.ClientId).Error()) + } + + if err := clientState.VerifyMembership(cachedCtx, k.ClientStore(cachedCtx, req.ClientId), k.cdc, req.ProofHeight, req.TimeDelay, req.BlockDelay, req.Proof, req.MerklePath, req.Value); err != nil { + k.Logger(ctx).Debug("proof verification failed", "key", req.MerklePath, "error", err) + return &types.QueryVerifyMembershipResponse{ + Success: false, + }, nil + } + + return &types.QueryVerifyMembershipResponse{ + Success: true, + }, nil +} diff --git a/modules/core/02-client/keeper/grpc_query_test.go b/modules/core/02-client/keeper/grpc_query_test.go index 9e15f9808b1..650bf6bcddd 100644 --- a/modules/core/02-client/keeper/grpc_query_test.go +++ b/modules/core/02-client/keeper/grpc_query_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "errors" "fmt" "google.golang.org/grpc/codes" @@ -12,9 +13,12 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" "github.com/cosmos/ibc-go/v8/modules/core/exported" ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" ibctesting "github.com/cosmos/ibc-go/v8/testing" + "github.com/cosmos/ibc-go/v8/testing/mock" ) func (suite *KeeperTestSuite) TestQueryClientState() { @@ -770,3 +774,143 @@ func (suite *KeeperTestSuite) TestQueryClientParams() { res, _ := suite.chainA.QueryServer.ClientParams(ctx, &types.QueryClientParamsRequest{}) suite.Require().Equal(&expParams, res.Params) } + +func (suite *KeeperTestSuite) TestQueryVerifyMembershipProof() { + var ( + path *ibctesting.Path + req *types.QueryVerifyMembershipRequest + ) + + testCases := []struct { + name string + malleate func() + expError error + }{ + { + "success", + func() { + channel := path.EndpointB.GetChannel() + bz, err := suite.chainB.Codec.Marshal(&channel) + suite.Require().NoError(err) + + channelProof, proofHeight := path.EndpointB.QueryProof(host.ChannelKey(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)) + + merklePath := commitmenttypes.NewMerklePath(host.ChannelPath(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)) + merklePath, err = commitmenttypes.ApplyPrefix(suite.chainB.GetPrefix(), merklePath) + suite.Require().NoError(err) + + req = &types.QueryVerifyMembershipRequest{ + ClientId: path.EndpointA.ClientID, + Proof: channelProof, + ProofHeight: proofHeight, + MerklePath: merklePath, + Value: bz, + } + }, + nil, + }, + { + "req is nil", + func() { + req = nil + }, + errors.New("empty request"), + }, + { + "invalid client ID", + func() { + req = &types.QueryVerifyMembershipRequest{ + ClientId: "//invalid_id", + } + }, + host.ErrInvalidID, + }, + { + "empty proof", + func() { + req = &types.QueryVerifyMembershipRequest{ + ClientId: ibctesting.FirstClientID, + Proof: []byte{}, + } + }, + errors.New("empty proof"), + }, + { + "invalid proof height", + func() { + req = &types.QueryVerifyMembershipRequest{ + ClientId: ibctesting.FirstClientID, + Proof: []byte{0x01}, + ProofHeight: types.ZeroHeight(), + } + }, + errors.New("proof height must be non-zero"), + }, + { + "empty merkle path", + func() { + req = &types.QueryVerifyMembershipRequest{ + ClientId: ibctesting.FirstClientID, + Proof: []byte{0x01}, + ProofHeight: types.NewHeight(1, 100), + } + }, + errors.New("empty merkle path"), + }, + { + "empty value", + func() { + req = &types.QueryVerifyMembershipRequest{ + ClientId: ibctesting.FirstClientID, + Proof: []byte{0x01}, + ProofHeight: types.NewHeight(1, 100), + MerklePath: commitmenttypes.NewMerklePath("/ibc", host.ChannelPath(mock.PortID, ibctesting.FirstChannelID)), + } + }, + errors.New("empty value"), + }, + { + "client not found", + func() { + req = &types.QueryVerifyMembershipRequest{ + ClientId: types.FormatClientIdentifier(exported.Tendermint, 100), // use a sequence which hasn't been created yet + Proof: []byte{0x01}, + ProofHeight: types.NewHeight(1, 100), + MerklePath: commitmenttypes.NewMerklePath("/ibc", host.ChannelPath(mock.PortID, ibctesting.FirstChannelID)), + Value: []byte{0x01}, + } + }, + types.ErrClientNotFound, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + suite.SetupTest() // reset + + path = ibctesting.NewPath(suite.chainA, suite.chainB) + path.Setup() + + tc.malleate() + + ctx := suite.chainA.GetContext() + initialGas := ctx.GasMeter().GasConsumed() + res, err := suite.chainA.QueryServer.VerifyMembership(ctx, req) + + expPass := tc.expError == nil + if expPass { + suite.Require().NoError(err) + suite.Require().True(res.Success, "failed to verify membership proof") + + gasConsumed := ctx.GasMeter().GasConsumed() + suite.Require().Greater(gasConsumed, initialGas, "gas consumed should be greater than initial gas") + } else { + suite.Require().ErrorContains(err, tc.expError.Error()) + + gasConsumed := ctx.GasMeter().GasConsumed() + suite.Require().GreaterOrEqual(gasConsumed, initialGas, "gas consumed should be greater than or equal to initial gas") + } + }) + } +} diff --git a/modules/core/02-client/types/query.pb.go b/modules/core/02-client/types/query.pb.go index e13ddd06cef..bad89fe1fdc 100644 --- a/modules/core/02-client/types/query.pb.go +++ b/modules/core/02-client/types/query.pb.go @@ -11,6 +11,7 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" + types1 "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -960,6 +961,152 @@ func (m *QueryUpgradedConsensusStateResponse) GetUpgradedConsensusState() *types return nil } +// QueryVerifyMembershipRequest is the request type for the Query/VerifyMembership RPC method +type QueryVerifyMembershipRequest struct { + // client unique identifier. + ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + // the proof to be verified by the client. + Proof []byte `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof,omitempty"` + // the height of the commitment root at which the proof is verified. + ProofHeight Height `protobuf:"bytes,3,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height"` + // the commitment key path. + MerklePath types1.MerklePath `protobuf:"bytes,4,opt,name=merkle_path,json=merklePath,proto3" json:"merkle_path"` + // the value which is proven. + Value []byte `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"` + // optional time delay + TimeDelay uint64 `protobuf:"varint,6,opt,name=time_delay,json=timeDelay,proto3" json:"time_delay,omitempty"` + // optional block delay + BlockDelay uint64 `protobuf:"varint,7,opt,name=block_delay,json=blockDelay,proto3" json:"block_delay,omitempty"` +} + +func (m *QueryVerifyMembershipRequest) Reset() { *m = QueryVerifyMembershipRequest{} } +func (m *QueryVerifyMembershipRequest) String() string { return proto.CompactTextString(m) } +func (*QueryVerifyMembershipRequest) ProtoMessage() {} +func (*QueryVerifyMembershipRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dc42cdfd1d52d76e, []int{18} +} +func (m *QueryVerifyMembershipRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVerifyMembershipRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVerifyMembershipRequest.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 *QueryVerifyMembershipRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVerifyMembershipRequest.Merge(m, src) +} +func (m *QueryVerifyMembershipRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryVerifyMembershipRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVerifyMembershipRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVerifyMembershipRequest proto.InternalMessageInfo + +func (m *QueryVerifyMembershipRequest) GetClientId() string { + if m != nil { + return m.ClientId + } + return "" +} + +func (m *QueryVerifyMembershipRequest) GetProof() []byte { + if m != nil { + return m.Proof + } + return nil +} + +func (m *QueryVerifyMembershipRequest) GetProofHeight() Height { + if m != nil { + return m.ProofHeight + } + return Height{} +} + +func (m *QueryVerifyMembershipRequest) GetMerklePath() types1.MerklePath { + if m != nil { + return m.MerklePath + } + return types1.MerklePath{} +} + +func (m *QueryVerifyMembershipRequest) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +func (m *QueryVerifyMembershipRequest) GetTimeDelay() uint64 { + if m != nil { + return m.TimeDelay + } + return 0 +} + +func (m *QueryVerifyMembershipRequest) GetBlockDelay() uint64 { + if m != nil { + return m.BlockDelay + } + return 0 +} + +// QueryVerifyMembershipResponse is the response type for the Query/VerifyMembership RPC method +type QueryVerifyMembershipResponse struct { + // boolean indicating success or failure of proof verification. + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` +} + +func (m *QueryVerifyMembershipResponse) Reset() { *m = QueryVerifyMembershipResponse{} } +func (m *QueryVerifyMembershipResponse) String() string { return proto.CompactTextString(m) } +func (*QueryVerifyMembershipResponse) ProtoMessage() {} +func (*QueryVerifyMembershipResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dc42cdfd1d52d76e, []int{19} +} +func (m *QueryVerifyMembershipResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVerifyMembershipResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVerifyMembershipResponse.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 *QueryVerifyMembershipResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVerifyMembershipResponse.Merge(m, src) +} +func (m *QueryVerifyMembershipResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryVerifyMembershipResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVerifyMembershipResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVerifyMembershipResponse proto.InternalMessageInfo + +func (m *QueryVerifyMembershipResponse) GetSuccess() bool { + if m != nil { + return m.Success + } + return false +} + func init() { proto.RegisterType((*QueryClientStateRequest)(nil), "ibc.core.client.v1.QueryClientStateRequest") proto.RegisterType((*QueryClientStateResponse)(nil), "ibc.core.client.v1.QueryClientStateResponse") @@ -979,78 +1126,92 @@ func init() { proto.RegisterType((*QueryUpgradedClientStateResponse)(nil), "ibc.core.client.v1.QueryUpgradedClientStateResponse") proto.RegisterType((*QueryUpgradedConsensusStateRequest)(nil), "ibc.core.client.v1.QueryUpgradedConsensusStateRequest") proto.RegisterType((*QueryUpgradedConsensusStateResponse)(nil), "ibc.core.client.v1.QueryUpgradedConsensusStateResponse") + proto.RegisterType((*QueryVerifyMembershipRequest)(nil), "ibc.core.client.v1.QueryVerifyMembershipRequest") + proto.RegisterType((*QueryVerifyMembershipResponse)(nil), "ibc.core.client.v1.QueryVerifyMembershipResponse") } func init() { proto.RegisterFile("ibc/core/client/v1/query.proto", fileDescriptor_dc42cdfd1d52d76e) } var fileDescriptor_dc42cdfd1d52d76e = []byte{ - // 1051 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xce, 0xa4, 0x69, 0xd4, 0x3e, 0xbb, 0x09, 0x9a, 0x26, 0xa9, 0xbb, 0x8d, 0x1c, 0x67, 0x83, - 0x68, 0x5a, 0x92, 0x9d, 0xc4, 0xa1, 0x49, 0x84, 0x84, 0x04, 0xa9, 0x54, 0xda, 0x4b, 0x29, 0x8b, - 0x10, 0x08, 0x09, 0x45, 0xbb, 0xeb, 0xc9, 0x66, 0x25, 0x7b, 0xc7, 0xf5, 0xec, 0x5a, 0x8a, 0xaa, - 0x5c, 0x7a, 0xe2, 0x06, 0x12, 0x12, 0x57, 0x24, 0x8e, 0x1c, 0x2a, 0x0e, 0x48, 0x5c, 0x39, 0x41, - 0x8e, 0x45, 0x70, 0xe0, 0x44, 0x51, 0xc2, 0x1f, 0x82, 0x3c, 0x33, 0x6b, 0xef, 0xda, 0xe3, 0x7a, - 0x8d, 0x42, 0x6f, 0xbb, 0xef, 0xe7, 0xf7, 0xbe, 0xf7, 0xfc, 0xde, 0x1a, 0xca, 0x81, 0xeb, 0x11, - 0x8f, 0xb5, 0x28, 0xf1, 0xea, 0x01, 0x0d, 0x23, 0xd2, 0xde, 0x24, 0x8f, 0x63, 0xda, 0x3a, 0xb2, - 0x9a, 0x2d, 0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ff, 0xff, 0x6f, 0xfe, 0x1b, 0x97, 0xbd, 0x0f, 0x00, 0x00, + // 1242 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcd, 0x4f, 0x1b, 0x47, + 0x1b, 0x67, 0x08, 0x10, 0x78, 0xec, 0x40, 0x34, 0x01, 0xe2, 0x2c, 0xc4, 0xc0, 0xf2, 0xbe, 0x85, + 0x50, 0xd8, 0xc5, 0xa6, 0x01, 0x1a, 0xa9, 0x52, 0x4b, 0xaa, 0x34, 0x1c, 0x92, 0x52, 0x57, 0xfd, + 0x50, 0xa5, 0xca, 0x5a, 0xaf, 0x07, 0x7b, 0x15, 0xef, 0xae, 0xe3, 0xd9, 0xb5, 0x84, 0x22, 0x2e, + 0x9c, 0x72, 0x6b, 0xa5, 0x4a, 0xbd, 0x56, 0xea, 0xb1, 0x87, 0x28, 0x87, 0x4a, 0xb9, 0xf6, 0xd4, + 0x72, 0x8c, 0xd4, 0x1e, 0x7a, 0x6a, 0x2a, 0xa8, 0xd4, 0x7f, 0xa3, 0xda, 0x99, 0x59, 0x7b, 0xd7, + 0x1e, 0xc7, 0xeb, 0x2a, 0xe9, 0xcd, 0xfb, 0x7c, 0xfe, 0x9e, 0x8f, 0x99, 0xdf, 0xc8, 0x90, 0xb5, + 0x4a, 0xa6, 0x6e, 0xba, 0x0d, 0xa2, 0x9b, 0x35, 0x8b, 0x38, 0x9e, 0xde, 0xcc, 0xe9, 0x0f, 0x7d, + 0xd2, 0x38, 0xd2, 0xea, 0x0d, 0xd7, 0x73, 0x31, 0xb6, 0x4a, 0xa6, 0x16, 0xe8, 0x35, 0xae, 0xd7, + 0x9a, 0x39, 0x65, 0xcd, 0x74, 0xa9, 0xed, 0x52, 0xbd, 0x64, 0x50, 0xc2, 0x8d, 0xf5, 0x66, 0xae, + 0x44, 0x3c, 0x23, 0xa7, 0xd7, 0x8d, 0x8a, 0x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0xd3, 0xca, 0x5b, 0x83, 0x39, + 0x09, 0x98, 0x79, 0x06, 0x73, 0x1d, 0xaf, 0xc9, 0x60, 0x4a, 0x29, 0x9d, 0xe2, 0x9f, 0x10, 0xcc, + 0xca, 0x89, 0x17, 0x6f, 0xf7, 0x07, 0x21, 0xbd, 0x5b, 0x76, 0x06, 0xf6, 0x4b, 0xb2, 0x0b, 0xbd, + 0xb8, 0x9f, 0x06, 0x97, 0xc5, 0xe5, 0x4e, 0x2a, 0xc2, 0xbd, 0x0f, 0x7f, 0x0f, 0xba, 0x57, 0x72, + 0x03, 0x78, 0x84, 0x80, 0x1f, 0xff, 0xfd, 0x74, 0x0d, 0x31, 0xd4, 0x6b, 0xb7, 0xd0, 0x9a, 0xfa, + 0x7f, 0x19, 0xf0, 0x26, 0xf3, 0x2e, 0xda, 0x2d, 0xf7, 0xbd, 0xc2, 0xe9, 0x59, 0x16, 0x3d, 0x3f, + 0xcb, 0xa2, 0x3f, 0xcf, 0xb2, 0xe8, 0xeb, 0xf3, 0xec, 0xd0, 0xf3, 0xf3, 0xec, 0xd0, 0xef, 0xe7, + 0xd9, 0xa1, 0x2f, 0x76, 0x2b, 0x96, 0x57, 0xf5, 0x4b, 0x01, 0xc5, 0xeb, 0xe2, 0x1f, 0x19, 0xab, + 0x64, 0x6e, 0x54, 0x5c, 0xbd, 0xb9, 0xab, 0xdb, 0x6e, 0xd9, 0xaf, 0x11, 0xca, 0xe3, 0x6f, 0xe6, + 0x37, 0x44, 0x0a, 0xef, 0xa8, 0x4e, 0x68, 0x69, 0x8c, 0xbd, 0x79, 0xb6, 0xfe, 0x09, 0x00, 0x00, + 0xff, 0xff, 0x78, 0xef, 0x8a, 0x42, 0x29, 0x12, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1085,6 +1246,8 @@ type QueryClient interface { UpgradedClientState(ctx context.Context, in *QueryUpgradedClientStateRequest, opts ...grpc.CallOption) (*QueryUpgradedClientStateResponse, error) // UpgradedConsensusState queries an Upgraded IBC consensus state. UpgradedConsensusState(ctx context.Context, in *QueryUpgradedConsensusStateRequest, opts ...grpc.CallOption) (*QueryUpgradedConsensusStateResponse, error) + // VerifyMembership queries an IBC light client for proof verification of a value at a given key path. + VerifyMembership(ctx context.Context, in *QueryVerifyMembershipRequest, opts ...grpc.CallOption) (*QueryVerifyMembershipResponse, error) } type queryClient struct { @@ -1176,6 +1339,15 @@ func (c *queryClient) UpgradedConsensusState(ctx context.Context, in *QueryUpgra return out, nil } +func (c *queryClient) VerifyMembership(ctx context.Context, in *QueryVerifyMembershipRequest, opts ...grpc.CallOption) (*QueryVerifyMembershipResponse, error) { + out := new(QueryVerifyMembershipResponse) + err := c.cc.Invoke(ctx, "/ibc.core.client.v1.Query/VerifyMembership", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // ClientState queries an IBC light client. @@ -1198,6 +1370,8 @@ type QueryServer interface { UpgradedClientState(context.Context, *QueryUpgradedClientStateRequest) (*QueryUpgradedClientStateResponse, error) // UpgradedConsensusState queries an Upgraded IBC consensus state. UpgradedConsensusState(context.Context, *QueryUpgradedConsensusStateRequest) (*QueryUpgradedConsensusStateResponse, error) + // VerifyMembership queries an IBC light client for proof verification of a value at a given key path. + VerifyMembership(context.Context, *QueryVerifyMembershipRequest) (*QueryVerifyMembershipResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1231,6 +1405,9 @@ func (*UnimplementedQueryServer) UpgradedClientState(ctx context.Context, req *Q func (*UnimplementedQueryServer) UpgradedConsensusState(ctx context.Context, req *QueryUpgradedConsensusStateRequest) (*QueryUpgradedConsensusStateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpgradedConsensusState not implemented") } +func (*UnimplementedQueryServer) VerifyMembership(ctx context.Context, req *QueryVerifyMembershipRequest) (*QueryVerifyMembershipResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method VerifyMembership not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1398,6 +1575,24 @@ func _Query_UpgradedConsensusState_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _Query_VerifyMembership_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVerifyMembershipRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).VerifyMembership(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.core.client.v1.Query/VerifyMembership", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).VerifyMembership(ctx, req.(*QueryVerifyMembershipRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "ibc.core.client.v1.Query", HandlerType: (*QueryServer)(nil), @@ -1438,6 +1633,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "UpgradedConsensusState", Handler: _Query_UpgradedConsensusState_Handler, }, + { + MethodName: "VerifyMembership", + Handler: _Query_VerifyMembership_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "ibc/core/client/v1/query.proto", @@ -2127,6 +2326,113 @@ func (m *QueryUpgradedConsensusStateResponse) MarshalToSizedBuffer(dAtA []byte) return len(dAtA) - i, nil } +func (m *QueryVerifyMembershipRequest) 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 *QueryVerifyMembershipRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVerifyMembershipRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BlockDelay != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BlockDelay)) + i-- + dAtA[i] = 0x38 + } + if m.TimeDelay != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.TimeDelay)) + i-- + dAtA[i] = 0x30 + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x2a + } + { + size, err := m.MerklePath.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size, err := m.ProofHeight.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Proof) > 0 { + i -= len(m.Proof) + copy(dAtA[i:], m.Proof) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Proof))) + i-- + dAtA[i] = 0x12 + } + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ClientId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryVerifyMembershipResponse) 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 *QueryVerifyMembershipResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVerifyMembershipResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Success { + i-- + if m.Success { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -2407,6 +2713,49 @@ func (m *QueryUpgradedConsensusStateResponse) Size() (n int) { return n } +func (m *QueryVerifyMembershipRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClientId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Proof) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = m.ProofHeight.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.MerklePath.Size() + n += 1 + l + sovQuery(uint64(l)) + l = len(m.Value) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.TimeDelay != 0 { + n += 1 + sovQuery(uint64(m.TimeDelay)) + } + if m.BlockDelay != 0 { + n += 1 + sovQuery(uint64(m.BlockDelay)) + } + return n +} + +func (m *QueryVerifyMembershipResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Success { + n += 2 + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -4195,6 +4544,330 @@ func (m *QueryUpgradedConsensusStateResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryVerifyMembershipRequest) 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 ErrIntOverflowQuery + } + 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: QueryVerifyMembershipRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVerifyMembershipRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Proof = append(m.Proof[:0], dAtA[iNdEx:postIndex]...) + if m.Proof == nil { + m.Proof = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ProofHeight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MerklePath", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MerklePath.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeDelay", wireType) + } + m.TimeDelay = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TimeDelay |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockDelay", wireType) + } + m.BlockDelay = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockDelay |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryVerifyMembershipResponse) 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 ErrIntOverflowQuery + } + 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: QueryVerifyMembershipResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVerifyMembershipResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Success = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/modules/core/02-client/types/query.pb.gw.go b/modules/core/02-client/types/query.pb.gw.go index 1e0e41f2579..70d1ac22c2f 100644 --- a/modules/core/02-client/types/query.pb.gw.go +++ b/modules/core/02-client/types/query.pb.gw.go @@ -491,6 +491,40 @@ func local_request_Query_UpgradedConsensusState_0(ctx context.Context, marshaler } +func request_Query_VerifyMembership_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVerifyMembershipRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.VerifyMembership(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_VerifyMembership_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryVerifyMembershipRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.VerifyMembership(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -704,6 +738,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("POST", pattern_Query_VerifyMembership_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_VerifyMembership_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_VerifyMembership_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -925,6 +982,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("POST", pattern_Query_VerifyMembership_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_VerifyMembership_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_VerifyMembership_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -946,6 +1023,8 @@ var ( pattern_Query_UpgradedClientState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"ibc", "core", "client", "v1", "upgraded_client_states"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_UpgradedConsensusState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"ibc", "core", "client", "v1", "upgraded_consensus_states"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_VerifyMembership_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"ibc", "core", "client", "v1", "verify_membership"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -966,4 +1045,6 @@ var ( forward_Query_UpgradedClientState_0 = runtime.ForwardResponseMessage forward_Query_UpgradedConsensusState_0 = runtime.ForwardResponseMessage + + forward_Query_VerifyMembership_0 = runtime.ForwardResponseMessage ) diff --git a/modules/core/keeper/grpc_query.go b/modules/core/keeper/grpc_query.go index 59807638af0..259fb55e7d2 100644 --- a/modules/core/keeper/grpc_query.go +++ b/modules/core/keeper/grpc_query.go @@ -53,6 +53,11 @@ func (k Keeper) UpgradedConsensusState(c context.Context, req *clienttypes.Query return k.ClientKeeper.UpgradedConsensusState(c, req) } +// VerifyMembership implements the IBC QueryServer interface. +func (k Keeper) VerifyMembership(c context.Context, req *clienttypes.QueryVerifyMembershipRequest) (*clienttypes.QueryVerifyMembershipResponse, error) { + return k.ClientKeeper.VerifyMembership(c, req) +} + // Connection implements the IBC QueryServer interface func (k Keeper) Connection(c context.Context, req *connectiontypes.QueryConnectionRequest) (*connectiontypes.QueryConnectionResponse, error) { return k.ConnectionKeeper.Connection(c, req) diff --git a/modules/light-clients/08-wasm/types/querier.go b/modules/light-clients/08-wasm/types/querier.go index e37b9bc9ad3..d9eb1376492 100644 --- a/modules/light-clients/08-wasm/types/querier.go +++ b/modules/light-clients/08-wasm/types/querier.go @@ -34,6 +34,11 @@ var ( _ ibcwasm.QueryPluginsI = (*QueryPlugins)(nil) ) +// defaultAcceptList defines a set of default allowed queries made available to the Querier. +var defaultAcceptList = []string{ + "/ibc.core.client.v1.Query/VerifyMembership", +} + // queryHandler is a wrapper around the sdk.Context and the CallerID that calls // into the query plugins. type queryHandler struct { @@ -129,8 +134,8 @@ func NewDefaultQueryPlugins() *QueryPlugins { // This function returns protobuf encoded responses in bytes. func AcceptListStargateQuerier(acceptedQueries []string) func(sdk.Context, *wasmvmtypes.StargateQuery) ([]byte, error) { return func(ctx sdk.Context, request *wasmvmtypes.StargateQuery) ([]byte, error) { - // A default list of accepted queries can be added here. - // accepted = append(defaultAcceptList, accepted...) + // append user defined accepted queries to default list defined above. + acceptedQueries = append(defaultAcceptList, acceptedQueries...) isAccepted := slices.Contains(acceptedQueries, request.Path) if !isAccepted { diff --git a/modules/light-clients/08-wasm/types/querier_test.go b/modules/light-clients/08-wasm/types/querier_test.go index 89a9cf911f6..51d66afbc17 100644 --- a/modules/light-clients/08-wasm/types/querier_test.go +++ b/modules/light-clients/08-wasm/types/querier_test.go @@ -14,6 +14,8 @@ import ( "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/internal/ibcwasm" wasmtesting "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/testing" "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" "github.com/cosmos/ibc-go/v8/modules/core/exported" ) @@ -118,6 +120,14 @@ func (suite *TypesTestSuite) TestCustomQuery() { func (suite *TypesTestSuite) TestStargateQuery() { typeURL := "/ibc.lightclients.wasm.v1.Query/Checksums" + var ( + endpoint *wasmtesting.WasmEndpoint + expDiscardedState = false + proofKey = []byte("mock-key") + testKey = []byte("test-key") + value = []byte("mock-value") + ) + testCases := []struct { name string malleate func() @@ -131,7 +141,7 @@ func (suite *TypesTestSuite) TestStargateQuery() { ibcwasm.SetQueryPlugins(&querierPlugin) - suite.mockVM.RegisterQueryCallback(types.StatusMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, querier wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) ([]byte, uint64, error) { + suite.mockVM.RegisterQueryCallback(types.StatusMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ []byte, store wasmvm.KVStore, _ wasmvm.GoAPI, querier wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) ([]byte, uint64, error) { queryRequest := types.QueryChecksumsRequest{} bz, err := queryRequest.Marshal() suite.Require().NoError(err) @@ -153,14 +163,95 @@ func (suite *TypesTestSuite) TestStargateQuery() { suite.Require().Len(respData.Checksums, 1) suite.Require().Equal(expChecksum, respData.Checksums[0]) + store.Set(testKey, value) + return resp, wasmtesting.DefaultGasUsed, nil }) }, }, { - "failure: default querier", + // The following test sets a mock proof key and value in the ibc store and registers a query callback on the Status msg. + // The Status handler will then perform the QueryVerifyMembershipRequest using the wasmvm.Querier. + // As the VerifyMembership query rpc will call directly back into the same client, we also register a callback for VerifyMembership. + // Here we decode the proof and verify the mock proof key and value are set in the ibc store. + // This exercises the full flow through the grpc handler and into the light client for verification, handling encoding and routing. + // Furthermore we write a test key and assert that the state changes made by this handler were discarded by the cachedCtx at the grpc handler. + "success: verify membership query", func() { + querierPlugin := types.QueryPlugins{ + Stargate: types.AcceptListStargateQuerier([]string{""}), + } + + ibcwasm.SetQueryPlugins(&querierPlugin) + + store := suite.chainA.GetContext().KVStore(GetSimApp(suite.chainA).GetKey(exported.StoreKey)) + store.Set(proofKey, value) + + suite.coordinator.CommitBlock(suite.chainA) + proof, proofHeight := endpoint.QueryProofAtHeight(proofKey, uint64(suite.chainA.GetContext().BlockHeight())) + + merklePath := commitmenttypes.NewMerklePath(string(proofKey)) + merklePath, err := commitmenttypes.ApplyPrefix(suite.chainA.GetPrefix(), merklePath) + suite.Require().NoError(err) + suite.mockVM.RegisterQueryCallback(types.StatusMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ []byte, _ wasmvm.KVStore, _ wasmvm.GoAPI, querier wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) ([]byte, uint64, error) { + queryRequest := clienttypes.QueryVerifyMembershipRequest{ + ClientId: endpoint.ClientID, + Proof: proof, + ProofHeight: proofHeight, + MerklePath: merklePath, + Value: value, + } + + bz, err := queryRequest.Marshal() + suite.Require().NoError(err) + + resp, err := querier.Query(wasmvmtypes.QueryRequest{ + Stargate: &wasmvmtypes.StargateQuery{ + Path: "/ibc.core.client.v1.Query/VerifyMembership", + Data: bz, + }, + }, math.MaxUint64) + suite.Require().NoError(err) + + var respData clienttypes.QueryVerifyMembershipResponse + err = respData.Unmarshal(resp) + suite.Require().NoError(err) + + suite.Require().True(respData.Success) + + return resp, wasmtesting.DefaultGasUsed, nil + }) + + suite.mockVM.RegisterSudoCallback(types.VerifyMembershipMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, sudoMsg []byte, store wasmvm.KVStore, + _ wasmvm.GoAPI, _ wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction, + ) (*wasmvmtypes.Response, uint64, error) { + var payload types.SudoMsg + err := json.Unmarshal(sudoMsg, &payload) + suite.Require().NoError(err) + + var merkleProof commitmenttypes.MerkleProof + err = suite.chainA.Codec.Unmarshal(payload.VerifyMembership.Proof, &merkleProof) + suite.Require().NoError(err) + + root := commitmenttypes.NewMerkleRoot(suite.chainA.App.LastCommitID().Hash) + err = merkleProof.VerifyMembership(commitmenttypes.GetSDKSpecs(), root, merklePath, payload.VerifyMembership.Value) + suite.Require().NoError(err) + + bz, err := json.Marshal(types.EmptyResult{}) + suite.Require().NoError(err) + + expDiscardedState = true + store.Set(testKey, value) + + return &wasmvmtypes.Response{Data: bz}, wasmtesting.DefaultGasUsed, nil + }) + }, + }, + { + "failure: default querier", + func() { + suite.mockVM.RegisterQueryCallback(types.StatusMsg{}, func(_ wasmvm.Checksum, _ wasmvmtypes.Env, _ []byte, store wasmvm.KVStore, _ wasmvm.GoAPI, querier wasmvm.Querier, _ wasmvm.GasMeter, _ uint64, _ wasmvmtypes.UFraction) ([]byte, uint64, error) { queryRequest := types.QueryChecksumsRequest{} bz, err := queryRequest.Marshal() suite.Require().NoError(err) @@ -174,6 +265,8 @@ func (suite *TypesTestSuite) TestStargateQuery() { suite.Require().ErrorIs(err, wasmvmtypes.UnsupportedRequest{Kind: fmt.Sprintf("'%s' path is not allowed from the contract", typeURL)}) suite.Require().Nil(resp) + store.Set(testKey, value) + return nil, wasmtesting.DefaultGasUsed, err }) }, @@ -182,9 +275,10 @@ func (suite *TypesTestSuite) TestStargateQuery() { for _, tc := range testCases { suite.Run(tc.name, func() { + expDiscardedState = false suite.SetupWasmWithMockVM() - endpoint := wasmtesting.NewWasmEndpoint(suite.chainA) + endpoint = wasmtesting.NewWasmEndpoint(suite.chainA) err := endpoint.CreateClient() suite.Require().NoError(err) @@ -194,6 +288,12 @@ func (suite *TypesTestSuite) TestStargateQuery() { clientState := endpoint.GetClientState() clientState.Status(suite.chainA.GetContext(), clientStore, suite.chainA.App.AppCodec()) + if expDiscardedState { + suite.Require().False(clientStore.Has(testKey)) + } else { + suite.Require().True(clientStore.Has(testKey)) + } + // reset query plugins after each test ibcwasm.SetQueryPlugins(types.NewDefaultQueryPlugins()) }) diff --git a/proto/ibc/core/client/v1/query.proto b/proto/ibc/core/client/v1/query.proto index c5f053010ce..905a9188b16 100644 --- a/proto/ibc/core/client/v1/query.proto +++ b/proto/ibc/core/client/v1/query.proto @@ -5,7 +5,9 @@ package ibc.core.client.v1; option go_package = "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"; import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/query/v1/query.proto"; import "ibc/core/client/v1/client.proto"; +import "ibc/core/commitment/v1/commitment.proto"; import "google/protobuf/any.proto"; import "google/api/annotations.proto"; import "gogoproto/gogo.proto"; @@ -60,6 +62,15 @@ service Query { rpc UpgradedConsensusState(QueryUpgradedConsensusStateRequest) returns (QueryUpgradedConsensusStateResponse) { option (google.api.http).get = "/ibc/core/client/v1/upgraded_consensus_states"; } + + // VerifyMembership queries an IBC light client for proof verification of a value at a given key path. + rpc VerifyMembership(QueryVerifyMembershipRequest) returns (QueryVerifyMembershipResponse) { + option (cosmos.query.v1.module_query_safe) = true; + option (google.api.http) = { + post: "/ibc/core/client/v1/verify_membership" + body: "*" + }; + } } // QueryClientStateRequest is the request type for the Query/ClientState RPC @@ -205,3 +216,27 @@ message QueryUpgradedConsensusStateResponse { // Consensus state associated with the request identifier google.protobuf.Any upgraded_consensus_state = 1; } + +// QueryVerifyMembershipRequest is the request type for the Query/VerifyMembership RPC method +message QueryVerifyMembershipRequest { + // client unique identifier. + string client_id = 1; + // the proof to be verified by the client. + bytes proof = 2; + // the height of the commitment root at which the proof is verified. + ibc.core.client.v1.Height proof_height = 3 [(gogoproto.nullable) = false]; + // the commitment key path. + ibc.core.commitment.v1.MerklePath merkle_path = 4 [(gogoproto.nullable) = false]; + // the value which is proven. + bytes value = 5; + // optional time delay + uint64 time_delay = 6; + // optional block delay + uint64 block_delay = 7; +} + +// QueryVerifyMembershipResponse is the response type for the Query/VerifyMembership RPC method +message QueryVerifyMembershipResponse { + // boolean indicating success or failure of proof verification. + bool success = 1; +} \ No newline at end of file