diff --git a/proto/ibc/connection/query.proto b/proto/ibc/connection/query.proto index ad6b644961..c0c6267893 100644 --- a/proto/ibc/connection/query.proto +++ b/proto/ibc/connection/query.proto @@ -3,31 +3,51 @@ package ibc.connection; import "gogoproto/gogo.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; +import "ibc/client/client.proto"; import "ibc/connection/connection.proto"; +import "google/protobuf/any.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"; // Query provides defines the gRPC querier service service Query { // Connection queries an IBC connection end. - rpc Connection(QueryConnectionRequest) returns (QueryConnectionResponse) {} + rpc Connection(QueryConnectionRequest) returns (QueryConnectionResponse) { + } // Connections queries all the IBC connections of a chain. - rpc Connections(QueryConnectionsRequest) returns (QueryConnectionsResponse) {} + rpc Connections(QueryConnectionsRequest) returns (QueryConnectionsResponse) { + } - // ClientConnections queries the connection paths associated with a client state. - rpc ClientConnections(QueryClientConnectionsRequest) returns (QueryClientConnectionsResponse) {} + // ClientConnections queries the connection paths associated with a client + // state. + rpc ClientConnections(QueryClientConnectionsRequest) + returns (QueryClientConnectionsResponse) { + } + + // ConnectionClientState queries the client state associated with the + // connection + rpc ConnectionClientState(QueryConnectionClientStateRequest) + returns (QueryConnectionClientStateResponse) { + } + + // ConnectionConsensusState queries the consensus state associated with the + // connection + rpc ConnectionConsensusState(QueryConnectionConsensusStateRequest) + returns (QueryConnectionConsensusStateResponse) { + } } -// QueryConnectionRequest is the request type for the Query/Connection RPC method +// QueryConnectionRequest is the request type for the Query/Connection RPC +// method message QueryConnectionRequest { // connection unique identifier string connection_id = 1 [(gogoproto.customname) = "ConnectionID"]; } -// QueryConnectionResponse is the response type for the Query/Connection RPC method. -// Besides the connection end, it includes a proof and the height from which the -// proof was retrieved. +// QueryConnectionResponse is the response type for the Query/Connection RPC +// method. Besides the connection end, it includes a proof and the height from +// which the proof was retrieved. message QueryConnectionResponse { // connection associated with the request identifier ibc.connection.ConnectionEnd connection = 1; @@ -39,12 +59,14 @@ message QueryConnectionResponse { uint64 proof_height = 4; } -// QueryConnectionsRequest is the request type for the Query/Connections RPC method +// QueryConnectionsRequest is the request type for the Query/Connections RPC +// method message QueryConnectionsRequest { cosmos.base.query.v1beta1.PageRequest pagination = 1; } -// QueryConnectionsResponse is the response type for the Query/Connections RPC method. +// QueryConnectionsResponse is the response type for the Query/Connections RPC +// method. message QueryConnectionsResponse { // list of stored connections of the chain. repeated ibc.connection.IdentifiedConnection connections = 1; @@ -54,15 +76,15 @@ message QueryConnectionsResponse { int64 height = 3; } -// QueryClientConnectionsRequest is the request type for the Query/ClientConnections -// RPC method +// QueryClientConnectionsRequest is the request type for the +// Query/ClientConnections RPC method message QueryClientConnectionsRequest { // client identifier associated with a connection string client_id = 1 [(gogoproto.customname) = "ClientID"]; } -// QueryClientConnectionsResponse is the response type for the Query/ClientConnections -// RPC method +// QueryClientConnectionsResponse is the response type for the +// Query/ClientConnections RPC method message QueryClientConnectionsResponse { // slice of all the connection paths associated with a client. repeated string connection_paths = 1; @@ -73,3 +95,52 @@ message QueryClientConnectionsResponse { // height at which the proof was generated uint64 proof_height = 4; } + +// QueryConnectionClientStateRequest is the request type for the +// Query/ConnectionClientState RPC method +message QueryConnectionClientStateRequest { + // connection identifier + string id = 1 [ + (gogoproto.customname) = "ConnectionID", + (gogoproto.moretags) = "yaml:\"connection_id\"" + ]; +} + +// QueryConnectionClientStateResponse is the response type for the +// Query/ConnectionClientState RPC method +message QueryConnectionClientStateResponse { + // client state associated with the channel + ibc.client.IdentifiedClientState identified_client_state = 1; + // merkle proof of existence + bytes proof = 2; + // merkle proof path + string proof_path = 3; + // height at which the proof was retrieved + uint64 proof_height = 4; +} + +// QueryConnectionConsensusStateRequest is the request type for the +// Query/ConnectionConsensusState RPC method +message QueryConnectionConsensusStateRequest { + // connection identifier + string connection_id = 1 [ + (gogoproto.customname) = "ConnectionID", + (gogoproto.moretags) = "yaml:\"connection_id\"" + ]; + uint64 height = 2; +} + +// QueryConnectionConsensusStateResponse is the response type for the +// Query/ConnectionConsensusState RPC method +message QueryConnectionConsensusStateResponse { + // consensus state associated with the channel + google.protobuf.Any consensus_state = 1; + // client ID associated with the consensus state + string client_id = 2 [(gogoproto.customname) = "ClientID"]; + // merkle proof of existence + bytes proof = 3; + // merkle proof path + string proof_path = 4; + // height at which the proof was retrieved + uint64 proof_height = 5; +} diff --git a/x/ibc-transfer/client/cli/tx.go b/x/ibc-transfer/client/cli/tx.go index 9bcee858f3..47b031703f 100644 --- a/x/ibc-transfer/client/cli/tx.go +++ b/x/ibc-transfer/client/cli/tx.go @@ -67,7 +67,7 @@ to the counterparty channel. Any timeout set to 0 is disabled.`), // if the timeouts are not absolute, retrieve latest block height and block timestamp // for the consensus state connected to the destination port/channel if !absoluteTimeouts { - consensusState, _, err := channelutils.QueryCounterpartyConsensusState(clientCtx, srcPort, srcChannel) + consensusState, _, err := channelutils.QueryCounterpartyConsensusState(clientCtx, srcPort, srcChannel, uint64(clientCtx.Height)) if err != nil { return err } diff --git a/x/ibc/03-connection/client/utils/utils.go b/x/ibc/03-connection/client/utils/utils.go index 2dbc18a32c..d1274e0941 100644 --- a/x/ibc/03-connection/client/utils/utils.go +++ b/x/ibc/03-connection/client/utils/utils.go @@ -11,6 +11,8 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" + clientutils "github.com/cosmos/cosmos-sdk/x/ibc/02-client/client/utils" + clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types" "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types" commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" host "github.com/cosmos/cosmos-sdk/x/ibc/24-host" @@ -102,6 +104,78 @@ func queryClientConnectionsABCI(clientCtx client.Context, clientID string) (*typ return types.NewQueryClientConnectionsResponse(clientID, paths, proofBz, res.Height), nil } +// QueryConnectionClientState returns the ClientState of a connection end. If +// prove is true, it performs an ABCI store query in order to retrieve the +// merkle proof. Otherwise, it uses the gRPC query client. +func QueryConnectionClientState( + clientCtx client.Context, connectionID string, prove bool, +) (*types.QueryConnectionClientStateResponse, error) { + + queryClient := types.NewQueryClient(clientCtx) + req := &types.QueryConnectionClientStateRequest{ + ConnectionID: connectionID, + } + + res, err := queryClient.ConnectionClientState(context.Background(), req) + if err != nil { + return nil, err + } + + if prove { + clientState, proof, proofHeight, err := clientutils.QueryClientStateABCI(clientCtx, res.IdentifiedClientState.ID) + if err != nil { + return nil, err + } + + // use client state returned from ABCI query in case query height differs + identifiedClientState := clienttypes.NewIdentifiedClientState(res.IdentifiedClientState.ID, clientState) + res = types.NewQueryConnectionClientStateResponse(identifiedClientState, proof, int64(proofHeight)) + } + + return res, nil +} + +// QueryConnectionConsensusState returns the ConsensusState of a connection end. If +// prove is true, it performs an ABCI store query in order to retrieve the +// merkle proof. Otherwise, it uses the gRPC query client. +func QueryConnectionConsensusState( + clientCtx client.Context, connectionID string, height uint64, prove bool, +) (*types.QueryConnectionConsensusStateResponse, error) { + + queryClient := types.NewQueryClient(clientCtx) + req := &types.QueryConnectionConsensusStateRequest{ + ConnectionID: connectionID, + Height: height, + } + + res, err := queryClient.ConnectionConsensusState(context.Background(), req) + if err != nil { + return nil, err + } + + consensusState, err := clienttypes.UnpackConsensusState(res.ConsensusState) + if err != nil { + return nil, err + } + + if prove { + consensusState, proof, proofHeight, err := clientutils.QueryConsensusStateABCI(clientCtx, res.ClientID, consensusState.GetHeight()) + if err != nil { + return nil, err + } + + // use consensus state returned from ABCI query in case query height differs + anyConsensusState, err := clienttypes.PackConsensusState(consensusState) + if err != nil { + return nil, err + } + + res = types.NewQueryConnectionConsensusStateResponse(res.ClientID, anyConsensusState, consensusState.GetHeight(), proof, int64(proofHeight)) + } + + return res, nil +} + // ParsePrefix unmarshals an cmd input argument from a JSON string to a commitment // Prefix. If the input is not a JSON, it looks for a path to the JSON file. func ParsePrefix(cdc *codec.LegacyAmino, arg string) (commitmenttypes.MerklePrefix, error) { diff --git a/x/ibc/03-connection/keeper/grpc_query.go b/x/ibc/03-connection/keeper/grpc_query.go index 017672086c..2ab638d91c 100644 --- a/x/ibc/03-connection/keeper/grpc_query.go +++ b/x/ibc/03-connection/keeper/grpc_query.go @@ -10,6 +10,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" + clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types" "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types" host "github.com/cosmos/cosmos-sdk/x/ibc/24-host" ) @@ -103,3 +104,73 @@ func (q Keeper) ClientConnections(c context.Context, req *types.QueryClientConne ProofHeight: uint64(ctx.BlockHeight()), }, nil } + +// ConnectionClientState implements the Query/ConnectionClientState gRPC method +func (q Keeper) ConnectionClientState(c context.Context, req *types.QueryConnectionClientStateRequest) (*types.QueryConnectionClientStateResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if err := host.ConnectionIdentifierValidator(req.ConnectionID); err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + ctx := sdk.UnwrapSDKContext(c) + + connection, found := q.GetConnection(ctx, req.ConnectionID) + if !found { + return nil, status.Error( + codes.NotFound, + sdkerrors.Wrapf(types.ErrConnectionNotFound, "connection-id: %s", req.ConnectionID).Error(), + ) + } + + clientState, found := q.clientKeeper.GetClientState(ctx, connection.ClientID) + if !found { + return nil, status.Error( + codes.NotFound, + sdkerrors.Wrapf(clienttypes.ErrClientNotFound, "client-id: %s", connection.ClientID).Error(), + ) + } + + identifiedClientState := clienttypes.NewIdentifiedClientState(connection.ClientID, clientState) + + return types.NewQueryConnectionClientStateResponse(identifiedClientState, nil, ctx.BlockHeight()), nil + +} + +// ConnectionConsensusState implements the Query/ConnectionConsensusState gRPC method +func (q Keeper) ConnectionConsensusState(c context.Context, req *types.QueryConnectionConsensusStateRequest) (*types.QueryConnectionConsensusStateResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + if err := host.ConnectionIdentifierValidator(req.ConnectionID); err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + ctx := sdk.UnwrapSDKContext(c) + + connection, found := q.GetConnection(ctx, req.ConnectionID) + if !found { + return nil, status.Error( + codes.NotFound, + sdkerrors.Wrapf(types.ErrConnectionNotFound, "connection-id: %s", req.ConnectionID).Error(), + ) + } + + consensusState, found := q.clientKeeper.GetClientConsensusState(ctx, connection.ClientID, req.Height) + if !found { + return nil, status.Error( + codes.NotFound, + sdkerrors.Wrapf(clienttypes.ErrConsensusStateNotFound, "client-id: %s", connection.ClientID).Error(), + ) + } + + anyConsensusState, err := clienttypes.PackConsensusState(consensusState) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return types.NewQueryConnectionConsensusStateResponse(connection.ClientID, anyConsensusState, consensusState.GetHeight(), nil, ctx.BlockHeight()), nil +} diff --git a/x/ibc/03-connection/keeper/grpc_query_test.go b/x/ibc/03-connection/keeper/grpc_query_test.go index 8a7b70c8ab..9f4dc2a1b0 100644 --- a/x/ibc/03-connection/keeper/grpc_query_test.go +++ b/x/ibc/03-connection/keeper/grpc_query_test.go @@ -6,6 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported" + clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types" "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types" ibctesting "github.com/cosmos/cosmos-sdk/x/ibc/testing" ) @@ -227,3 +228,180 @@ func (suite *KeeperTestSuite) TestQueryClientConnections() { }) } } + +func (suite *KeeperTestSuite) TestQueryConnectionClientState() { + var ( + req *types.QueryConnectionClientStateRequest + expIdentifiedClientState clienttypes.IdentifiedClientState + ) + + testCases := []struct { + msg string + malleate func() + expPass bool + }{ + { + "empty request", + func() { + req = nil + }, + false, + }, + { + "invalid connection ID", + func() { + req = &types.QueryConnectionClientStateRequest{ + ConnectionID: "", + } + }, + false, + }, + { + "connection not found", + func() { + req = &types.QueryConnectionClientStateRequest{ + ConnectionID: "test-connection-id", + } + }, + false, + }, + { + "client state not found", + func() { + _, _, connA, _, _, _ := suite.coordinator.Setup(suite.chainA, suite.chainB) + + // set connection to empty so clientID is empty + suite.chainA.App.IBCKeeper.ConnectionKeeper.SetConnection(suite.chainA.GetContext(), connA.ID, types.ConnectionEnd{}) + + req = &types.QueryConnectionClientStateRequest{ + ConnectionID: connA.ID, + } + }, false, + }, + { + "success", + func() { + clientA, _, connA, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint) + + expClientState := suite.chainA.GetClientState(clientA) + expIdentifiedClientState = clienttypes.NewIdentifiedClientState(clientA, expClientState) + + req = &types.QueryConnectionClientStateRequest{ + ConnectionID: connA.ID, + } + }, + true, + }, + } + + for _, tc := range testCases { + suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { + suite.SetupTest() // reset + + tc.malleate() + ctx := sdk.WrapSDKContext(suite.chainA.GetContext()) + + res, err := suite.chainA.QueryServer.ConnectionClientState(ctx, req) + + if tc.expPass { + suite.Require().NoError(err) + suite.Require().NotNil(res) + suite.Require().Equal(&expIdentifiedClientState, res.IdentifiedClientState) + } else { + suite.Require().Error(err) + } + }) + } +} + +func (suite *KeeperTestSuite) TestQueryConnectionConsensusState() { + var ( + req *types.QueryConnectionConsensusStateRequest + expConsensusState clientexported.ConsensusState + expClientID string + ) + + testCases := []struct { + msg string + malleate func() + expPass bool + }{ + { + "empty request", + func() { + req = nil + }, + false, + }, + { + "invalid connection ID", + func() { + req = &types.QueryConnectionConsensusStateRequest{ + ConnectionID: "", + Height: 1, + } + }, + false, + }, + { + "connection not found", + func() { + req = &types.QueryConnectionConsensusStateRequest{ + ConnectionID: "test-connection-id", + Height: 1, + } + }, + false, + }, + { + "consensus state not found", + func() { + _, _, connA, _, _, _ := suite.coordinator.Setup(suite.chainA, suite.chainB) + + req = &types.QueryConnectionConsensusStateRequest{ + ConnectionID: connA.ID, + Height: uint64(suite.chainA.GetContext().BlockHeight()), // use current height + } + }, false, + }, + { + "success", + func() { + clientA, _, connA, _ := suite.coordinator.SetupClientConnections(suite.chainA, suite.chainB, clientexported.Tendermint) + + clientState := suite.chainA.GetClientState(clientA) + expConsensusState, _ = suite.chainA.GetConsensusState(clientA, clientState.GetLatestHeight()) + suite.Require().NotNil(expConsensusState) + expClientID = clientA + + req = &types.QueryConnectionConsensusStateRequest{ + ConnectionID: connA.ID, + Height: expConsensusState.GetHeight(), + } + }, + true, + }, + } + + for _, tc := range testCases { + suite.Run(fmt.Sprintf("Case %s", tc.msg), func() { + suite.SetupTest() // reset + + tc.malleate() + ctx := sdk.WrapSDKContext(suite.chainA.GetContext()) + + res, err := suite.chainA.QueryServer.ConnectionConsensusState(ctx, req) + + if tc.expPass { + suite.Require().NoError(err) + suite.Require().NotNil(res) + consensusState, err := clienttypes.UnpackConsensusState(res.ConsensusState) + suite.Require().NoError(err) + suite.Require().Equal(expConsensusState, consensusState) + suite.Require().Equal(expClientID, res.ClientID) + } else { + suite.Require().Error(err) + } + }) + } +} diff --git a/x/ibc/03-connection/types/querier.go b/x/ibc/03-connection/types/querier.go deleted file mode 100644 index 9d9a01cd21..0000000000 --- a/x/ibc/03-connection/types/querier.go +++ /dev/null @@ -1,41 +0,0 @@ -package types - -import ( - "strings" - - commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" - host "github.com/cosmos/cosmos-sdk/x/ibc/24-host" -) - -// NewQueryConnectionResponse creates a new QueryConnectionResponse instance -func NewQueryConnectionResponse( - connectionID string, connection ConnectionEnd, proof []byte, height int64, -) *QueryConnectionResponse { - path := commitmenttypes.NewMerklePath(strings.Split(host.ConnectionPath(connectionID), "/")) - return &QueryConnectionResponse{ - Connection: &connection, - Proof: proof, - ProofPath: path.Pretty(), - ProofHeight: uint64(height), - } -} - -// NewQueryClientConnectionsResponse creates a new ConnectionPaths instance -func NewQueryClientConnectionsResponse( - clientID string, connectionPaths []string, proof []byte, height int64, -) *QueryClientConnectionsResponse { - path := commitmenttypes.NewMerklePath(strings.Split(host.ClientConnectionsPath(clientID), "/")) - return &QueryClientConnectionsResponse{ - ConnectionPaths: connectionPaths, - Proof: proof, - ProofPath: path.Pretty(), - ProofHeight: uint64(height), - } -} - -// NewQueryClientConnectionsRequest creates a new QueryClientConnectionsRequest instance -func NewQueryClientConnectionsRequest(clientID string) *QueryClientConnectionsRequest { - return &QueryClientConnectionsRequest{ - ClientID: clientID, - } -} diff --git a/x/ibc/03-connection/types/query.go b/x/ibc/03-connection/types/query.go new file mode 100644 index 0000000000..f46d0af2a8 --- /dev/null +++ b/x/ibc/03-connection/types/query.go @@ -0,0 +1,66 @@ +package types + +import ( + "strings" + + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types" + commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types" + host "github.com/cosmos/cosmos-sdk/x/ibc/24-host" +) + +// NewQueryConnectionResponse creates a new QueryConnectionResponse instance +func NewQueryConnectionResponse( + connectionID string, connection ConnectionEnd, proof []byte, height int64, +) *QueryConnectionResponse { + path := commitmenttypes.NewMerklePath(strings.Split(host.ConnectionPath(connectionID), "/")) + return &QueryConnectionResponse{ + Connection: &connection, + Proof: proof, + ProofPath: path.Pretty(), + ProofHeight: uint64(height), + } +} + +// NewQueryClientConnectionsResponse creates a new ConnectionPaths instance +func NewQueryClientConnectionsResponse( + clientID string, connectionPaths []string, proof []byte, height int64, +) *QueryClientConnectionsResponse { + path := commitmenttypes.NewMerklePath(strings.Split(host.ClientConnectionsPath(clientID), "/")) + return &QueryClientConnectionsResponse{ + ConnectionPaths: connectionPaths, + Proof: proof, + ProofPath: path.Pretty(), + ProofHeight: uint64(height), + } +} + +// NewQueryClientConnectionsRequest creates a new QueryClientConnectionsRequest instance +func NewQueryClientConnectionsRequest(clientID string) *QueryClientConnectionsRequest { + return &QueryClientConnectionsRequest{ + ClientID: clientID, + } +} + +// NewQueryConnectionClientStateResponse creates a newQueryConnectionClientStateResponse instance +func NewQueryConnectionClientStateResponse(identifiedClientState clienttypes.IdentifiedClientState, proof []byte, height int64) *QueryConnectionClientStateResponse { + path := commitmenttypes.NewMerklePath(strings.Split(host.FullClientPath(identifiedClientState.ID, host.ClientStatePath()), "/")) + return &QueryConnectionClientStateResponse{ + IdentifiedClientState: &identifiedClientState, + Proof: proof, + ProofPath: path.Pretty(), + ProofHeight: uint64(height), + } +} + +// NewQueryConnectionConsensusStateResponse creates a newQueryConnectionConsensusStateResponse instance +func NewQueryConnectionConsensusStateResponse(clientID string, anyConsensusState *codectypes.Any, consensusStateHeight uint64, proof []byte, height int64) *QueryConnectionConsensusStateResponse { + path := commitmenttypes.NewMerklePath(strings.Split(host.FullClientPath(clientID, host.ConsensusStatePath(consensusStateHeight)), "/")) + return &QueryConnectionConsensusStateResponse{ + ConsensusState: anyConsensusState, + ClientID: clientID, + Proof: proof, + ProofPath: path.Pretty(), + ProofHeight: uint64(height), + } +} diff --git a/x/ibc/03-connection/types/query.pb.go b/x/ibc/03-connection/types/query.pb.go index 045fea4661..c5ac907e8a 100644 --- a/x/ibc/03-connection/types/query.pb.go +++ b/x/ibc/03-connection/types/query.pb.go @@ -6,7 +6,9 @@ package types import ( context "context" fmt "fmt" + types1 "github.com/cosmos/cosmos-sdk/codec/types" query "github.com/cosmos/cosmos-sdk/types/query" + types "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types" _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" @@ -29,7 +31,8 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// QueryConnectionRequest is the request type for the Query/Connection RPC method +// QueryConnectionRequest is the request type for the Query/Connection RPC +// method type QueryConnectionRequest struct { // connection unique identifier ConnectionID string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` @@ -75,9 +78,9 @@ func (m *QueryConnectionRequest) GetConnectionID() string { return "" } -// QueryConnectionResponse is the response type for the Query/Connection RPC method. -// Besides the connection end, it includes a proof and the height from which the -// proof was retrieved. +// QueryConnectionResponse is the response type for the Query/Connection RPC +// method. Besides the connection end, it includes a proof and the height from +// which the proof was retrieved. type QueryConnectionResponse struct { // connection associated with the request identifier Connection *ConnectionEnd `protobuf:"bytes,1,opt,name=connection,proto3" json:"connection,omitempty"` @@ -150,7 +153,8 @@ func (m *QueryConnectionResponse) GetProofHeight() uint64 { return 0 } -// QueryConnectionsRequest is the request type for the Query/Connections RPC method +// QueryConnectionsRequest is the request type for the Query/Connections RPC +// method type QueryConnectionsRequest struct { Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -195,7 +199,8 @@ func (m *QueryConnectionsRequest) GetPagination() *query.PageRequest { return nil } -// QueryConnectionsResponse is the response type for the Query/Connections RPC method. +// QueryConnectionsResponse is the response type for the Query/Connections RPC +// method. type QueryConnectionsResponse struct { // list of stored connections of the chain. Connections []*IdentifiedConnection `protobuf:"bytes,1,rep,name=connections,proto3" json:"connections,omitempty"` @@ -259,8 +264,8 @@ func (m *QueryConnectionsResponse) GetHeight() int64 { return 0 } -// QueryClientConnectionsRequest is the request type for the Query/ClientConnections -// RPC method +// QueryClientConnectionsRequest is the request type for the +// Query/ClientConnections RPC method type QueryClientConnectionsRequest struct { // client identifier associated with a connection ClientID string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` @@ -306,8 +311,8 @@ func (m *QueryClientConnectionsRequest) GetClientID() string { return "" } -// QueryClientConnectionsResponse is the response type for the Query/ClientConnections -// RPC method +// QueryClientConnectionsResponse is the response type for the +// Query/ClientConnections RPC method type QueryClientConnectionsResponse struct { // slice of all the connection paths associated with a client. ConnectionPaths []string `protobuf:"bytes,1,rep,name=connection_paths,json=connectionPaths,proto3" json:"connection_paths,omitempty"` @@ -380,6 +385,265 @@ func (m *QueryClientConnectionsResponse) GetProofHeight() uint64 { return 0 } +// QueryConnectionClientStateRequest is the request type for the +// Query/ConnectionClientState RPC method +type QueryConnectionClientStateRequest struct { + // connection identifier + ConnectionID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" yaml:"connection_id"` +} + +func (m *QueryConnectionClientStateRequest) Reset() { *m = QueryConnectionClientStateRequest{} } +func (m *QueryConnectionClientStateRequest) String() string { return proto.CompactTextString(m) } +func (*QueryConnectionClientStateRequest) ProtoMessage() {} +func (*QueryConnectionClientStateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5ee60d8b08ce3606, []int{6} +} +func (m *QueryConnectionClientStateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryConnectionClientStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryConnectionClientStateRequest.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 *QueryConnectionClientStateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConnectionClientStateRequest.Merge(m, src) +} +func (m *QueryConnectionClientStateRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryConnectionClientStateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConnectionClientStateRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryConnectionClientStateRequest proto.InternalMessageInfo + +func (m *QueryConnectionClientStateRequest) GetConnectionID() string { + if m != nil { + return m.ConnectionID + } + return "" +} + +// QueryConnectionClientStateResponse is the response type for the +// Query/ConnectionClientState RPC method +type QueryConnectionClientStateResponse struct { + // client state associated with the channel + IdentifiedClientState *types.IdentifiedClientState `protobuf:"bytes,1,opt,name=identified_client_state,json=identifiedClientState,proto3" json:"identified_client_state,omitempty"` + // merkle proof of existence + Proof []byte `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof,omitempty"` + // merkle proof path + ProofPath string `protobuf:"bytes,3,opt,name=proof_path,json=proofPath,proto3" json:"proof_path,omitempty"` + // height at which the proof was retrieved + ProofHeight uint64 `protobuf:"varint,4,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty"` +} + +func (m *QueryConnectionClientStateResponse) Reset() { *m = QueryConnectionClientStateResponse{} } +func (m *QueryConnectionClientStateResponse) String() string { return proto.CompactTextString(m) } +func (*QueryConnectionClientStateResponse) ProtoMessage() {} +func (*QueryConnectionClientStateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5ee60d8b08ce3606, []int{7} +} +func (m *QueryConnectionClientStateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryConnectionClientStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryConnectionClientStateResponse.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 *QueryConnectionClientStateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConnectionClientStateResponse.Merge(m, src) +} +func (m *QueryConnectionClientStateResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryConnectionClientStateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConnectionClientStateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryConnectionClientStateResponse proto.InternalMessageInfo + +func (m *QueryConnectionClientStateResponse) GetIdentifiedClientState() *types.IdentifiedClientState { + if m != nil { + return m.IdentifiedClientState + } + return nil +} + +func (m *QueryConnectionClientStateResponse) GetProof() []byte { + if m != nil { + return m.Proof + } + return nil +} + +func (m *QueryConnectionClientStateResponse) GetProofPath() string { + if m != nil { + return m.ProofPath + } + return "" +} + +func (m *QueryConnectionClientStateResponse) GetProofHeight() uint64 { + if m != nil { + return m.ProofHeight + } + return 0 +} + +// QueryConnectionConsensusStateRequest is the request type for the +// Query/ConnectionConsensusState RPC method +type QueryConnectionConsensusStateRequest struct { + // connection identifier + ConnectionID string `protobuf:"bytes,1,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty" yaml:"connection_id"` + Height uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryConnectionConsensusStateRequest) Reset() { *m = QueryConnectionConsensusStateRequest{} } +func (m *QueryConnectionConsensusStateRequest) String() string { return proto.CompactTextString(m) } +func (*QueryConnectionConsensusStateRequest) ProtoMessage() {} +func (*QueryConnectionConsensusStateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5ee60d8b08ce3606, []int{8} +} +func (m *QueryConnectionConsensusStateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryConnectionConsensusStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryConnectionConsensusStateRequest.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 *QueryConnectionConsensusStateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConnectionConsensusStateRequest.Merge(m, src) +} +func (m *QueryConnectionConsensusStateRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryConnectionConsensusStateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConnectionConsensusStateRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryConnectionConsensusStateRequest proto.InternalMessageInfo + +func (m *QueryConnectionConsensusStateRequest) GetConnectionID() string { + if m != nil { + return m.ConnectionID + } + return "" +} + +func (m *QueryConnectionConsensusStateRequest) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +// QueryConnectionConsensusStateResponse is the response type for the +// Query/ConnectionConsensusState RPC method +type QueryConnectionConsensusStateResponse struct { + // consensus state associated with the channel + ConsensusState *types1.Any `protobuf:"bytes,1,opt,name=consensus_state,json=consensusState,proto3" json:"consensus_state,omitempty"` + // client ID associated with the consensus state + ClientID string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + // merkle proof of existence + Proof []byte `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof,omitempty"` + // merkle proof path + ProofPath string `protobuf:"bytes,4,opt,name=proof_path,json=proofPath,proto3" json:"proof_path,omitempty"` + // height at which the proof was retrieved + ProofHeight uint64 `protobuf:"varint,5,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty"` +} + +func (m *QueryConnectionConsensusStateResponse) Reset() { *m = QueryConnectionConsensusStateResponse{} } +func (m *QueryConnectionConsensusStateResponse) String() string { return proto.CompactTextString(m) } +func (*QueryConnectionConsensusStateResponse) ProtoMessage() {} +func (*QueryConnectionConsensusStateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5ee60d8b08ce3606, []int{9} +} +func (m *QueryConnectionConsensusStateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryConnectionConsensusStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryConnectionConsensusStateResponse.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 *QueryConnectionConsensusStateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConnectionConsensusStateResponse.Merge(m, src) +} +func (m *QueryConnectionConsensusStateResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryConnectionConsensusStateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConnectionConsensusStateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryConnectionConsensusStateResponse proto.InternalMessageInfo + +func (m *QueryConnectionConsensusStateResponse) GetConsensusState() *types1.Any { + if m != nil { + return m.ConsensusState + } + return nil +} + +func (m *QueryConnectionConsensusStateResponse) GetClientID() string { + if m != nil { + return m.ClientID + } + return "" +} + +func (m *QueryConnectionConsensusStateResponse) GetProof() []byte { + if m != nil { + return m.Proof + } + return nil +} + +func (m *QueryConnectionConsensusStateResponse) GetProofPath() string { + if m != nil { + return m.ProofPath + } + return "" +} + +func (m *QueryConnectionConsensusStateResponse) GetProofHeight() uint64 { + if m != nil { + return m.ProofHeight + } + return 0 +} + func init() { proto.RegisterType((*QueryConnectionRequest)(nil), "ibc.connection.QueryConnectionRequest") proto.RegisterType((*QueryConnectionResponse)(nil), "ibc.connection.QueryConnectionResponse") @@ -387,47 +651,66 @@ func init() { proto.RegisterType((*QueryConnectionsResponse)(nil), "ibc.connection.QueryConnectionsResponse") proto.RegisterType((*QueryClientConnectionsRequest)(nil), "ibc.connection.QueryClientConnectionsRequest") proto.RegisterType((*QueryClientConnectionsResponse)(nil), "ibc.connection.QueryClientConnectionsResponse") + proto.RegisterType((*QueryConnectionClientStateRequest)(nil), "ibc.connection.QueryConnectionClientStateRequest") + proto.RegisterType((*QueryConnectionClientStateResponse)(nil), "ibc.connection.QueryConnectionClientStateResponse") + proto.RegisterType((*QueryConnectionConsensusStateRequest)(nil), "ibc.connection.QueryConnectionConsensusStateRequest") + proto.RegisterType((*QueryConnectionConsensusStateResponse)(nil), "ibc.connection.QueryConnectionConsensusStateResponse") } func init() { proto.RegisterFile("ibc/connection/query.proto", fileDescriptor_5ee60d8b08ce3606) } var fileDescriptor_5ee60d8b08ce3606 = []byte{ - // 556 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xcf, 0x6e, 0xd3, 0x30, - 0x1c, 0xae, 0xdb, 0x6d, 0x5a, 0x7f, 0x2d, 0x30, 0xac, 0x69, 0x44, 0x91, 0x9a, 0x96, 0x08, 0x6d, - 0x1d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xbd, 0xc8, 0xfe, - 0x8e, 0xc0, 0xba, 0xad, 0x59, 0xee, 0xcb, 0x3e, 0x6c, 0x15, 0x5e, 0x60, 0x16, 0xaf, 0x32, 0xa7, - 0xea, 0x3d, 0xd0, 0xfb, 0x59, 0xc8, 0xfc, 0xae, 0x9e, 0x46, 0xf7, 0x67, 0x19, 0xd6, 0xa5, 0x4a, - 0x3c, 0x00, 0xd0, 0x1a, 0xf1, 0xee, 0x7c, 0x3a, 0xcb, 0xff, 0x44, 0xe6, 0xde, 0x4a, 0x9c, 0xba, - 0xab, 0x5d, 0xc2, 0x01, 0xd4, 0x0a, 0x26, 0xe0, 0x55, 0xcc, 0x99, 0xe7, 0x66, 0x7b, 0x35, 0xf0, - 0xfa, 0x0c, 0x01, 0x0f, 0x17, 0xec, 0xc6, 0x9d, 0xe5, 0x0d, 0x6e, 0xc9, 0xd8, 0x74, 0xfe, 0x17, - 0x3e, 0x3b, 0xf5, 0xa8, 0xff, 0x7b, 0x62, 0xa1, 0xcb, 0x89, 0x85, 0xfe, 0x4e, 0x2c, 0xf4, 0x6d, - 0x6a, 0x95, 0x2e, 0xa7, 0x56, 0xe9, 0xcf, 0xd4, 0x2a, 0x7d, 0x7c, 0x11, 0x53, 0x31, 0x1c, 0x07, - 0x4e, 0xc8, 0xce, 0xdc, 0x7c, 0xaa, 0xa9, 0x9f, 0x0e, 0x8f, 0x3e, 0xb9, 0x5f, 0xdd, 0x6c, 0x7a, - 0x3d, 0x3b, 0xec, 0x14, 0x06, 0x98, 0xb8, 0x48, 0x09, 0x0f, 0x36, 0xe4, 0xf0, 0x3a, 0xfc, 0x17, - 0x00, 0x00, 0xff, 0xff, 0x77, 0xdb, 0xec, 0x23, 0x4d, 0x05, 0x00, 0x00, + // 787 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x6e, 0xd3, 0x4a, + 0x14, 0xce, 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1, 0x41, 0xcd, + 0xd7, 0xea, 0x5b, 0xd5, 0xfb, 0x39, 0xb9, 0xb1, 0xb5, 0x11, 0xfa, 0x3f, 0x61, 0xbd, 0x8e, 0x45, + 0x8d, 0x69, 0x7f, 0x8d, 0xb6, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0xcd, 0x52, 0x4d, 0x28, 0x45, + 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -446,8 +729,15 @@ type QueryClient interface { Connection(ctx context.Context, in *QueryConnectionRequest, opts ...grpc.CallOption) (*QueryConnectionResponse, error) // Connections queries all the IBC connections of a chain. Connections(ctx context.Context, in *QueryConnectionsRequest, opts ...grpc.CallOption) (*QueryConnectionsResponse, error) - // ClientConnections queries the connection paths associated with a client state. + // ClientConnections queries the connection paths associated with a client + // state. ClientConnections(ctx context.Context, in *QueryClientConnectionsRequest, opts ...grpc.CallOption) (*QueryClientConnectionsResponse, error) + // ConnectionClientState queries the client state associated with the + // connection + ConnectionClientState(ctx context.Context, in *QueryConnectionClientStateRequest, opts ...grpc.CallOption) (*QueryConnectionClientStateResponse, error) + // ConnectionConsensusState queries the consensus state associated with the + // connection + ConnectionConsensusState(ctx context.Context, in *QueryConnectionConsensusStateRequest, opts ...grpc.CallOption) (*QueryConnectionConsensusStateResponse, error) } type queryClient struct { @@ -485,14 +775,39 @@ func (c *queryClient) ClientConnections(ctx context.Context, in *QueryClientConn return out, nil } +func (c *queryClient) ConnectionClientState(ctx context.Context, in *QueryConnectionClientStateRequest, opts ...grpc.CallOption) (*QueryConnectionClientStateResponse, error) { + out := new(QueryConnectionClientStateResponse) + err := c.cc.Invoke(ctx, "/ibc.connection.Query/ConnectionClientState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ConnectionConsensusState(ctx context.Context, in *QueryConnectionConsensusStateRequest, opts ...grpc.CallOption) (*QueryConnectionConsensusStateResponse, error) { + out := new(QueryConnectionConsensusStateResponse) + err := c.cc.Invoke(ctx, "/ibc.connection.Query/ConnectionConsensusState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Connection queries an IBC connection end. Connection(context.Context, *QueryConnectionRequest) (*QueryConnectionResponse, error) // Connections queries all the IBC connections of a chain. Connections(context.Context, *QueryConnectionsRequest) (*QueryConnectionsResponse, error) - // ClientConnections queries the connection paths associated with a client state. + // ClientConnections queries the connection paths associated with a client + // state. ClientConnections(context.Context, *QueryClientConnectionsRequest) (*QueryClientConnectionsResponse, error) + // ConnectionClientState queries the client state associated with the + // connection + ConnectionClientState(context.Context, *QueryConnectionClientStateRequest) (*QueryConnectionClientStateResponse, error) + // ConnectionConsensusState queries the consensus state associated with the + // connection + ConnectionConsensusState(context.Context, *QueryConnectionConsensusStateRequest) (*QueryConnectionConsensusStateResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -508,6 +823,12 @@ func (*UnimplementedQueryServer) Connections(ctx context.Context, req *QueryConn func (*UnimplementedQueryServer) ClientConnections(ctx context.Context, req *QueryClientConnectionsRequest) (*QueryClientConnectionsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ClientConnections not implemented") } +func (*UnimplementedQueryServer) ConnectionClientState(ctx context.Context, req *QueryConnectionClientStateRequest) (*QueryConnectionClientStateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConnectionClientState not implemented") +} +func (*UnimplementedQueryServer) ConnectionConsensusState(ctx context.Context, req *QueryConnectionConsensusStateRequest) (*QueryConnectionConsensusStateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConnectionConsensusState not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -567,6 +888,42 @@ func _Query_ClientConnections_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Query_ConnectionClientState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryConnectionClientStateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ConnectionClientState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.connection.Query/ConnectionClientState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ConnectionClientState(ctx, req.(*QueryConnectionClientStateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ConnectionConsensusState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryConnectionConsensusStateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ConnectionConsensusState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.connection.Query/ConnectionConsensusState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ConnectionConsensusState(ctx, req.(*QueryConnectionConsensusStateRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "ibc.connection.Query", HandlerType: (*QueryServer)(nil), @@ -583,6 +940,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "ClientConnections", Handler: _Query_ClientConnections_Handler, }, + { + MethodName: "ConnectionClientState", + Handler: _Query_ConnectionClientState_Handler, + }, + { + MethodName: "ConnectionConsensusState", + Handler: _Query_ConnectionConsensusState_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "ibc/connection/query.proto", @@ -842,6 +1207,186 @@ func (m *QueryClientConnectionsResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } +func (m *QueryConnectionClientStateRequest) 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 *QueryConnectionClientStateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConnectionClientStateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ConnectionID) > 0 { + i -= len(m.ConnectionID) + copy(dAtA[i:], m.ConnectionID) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConnectionID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryConnectionClientStateResponse) 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 *QueryConnectionClientStateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConnectionClientStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ProofHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProofHeight)) + i-- + dAtA[i] = 0x20 + } + if len(m.ProofPath) > 0 { + i -= len(m.ProofPath) + copy(dAtA[i:], m.ProofPath) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ProofPath))) + 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 m.IdentifiedClientState != nil { + { + size, err := m.IdentifiedClientState.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryConnectionConsensusStateRequest) 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 *QueryConnectionConsensusStateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConnectionConsensusStateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x10 + } + if len(m.ConnectionID) > 0 { + i -= len(m.ConnectionID) + copy(dAtA[i:], m.ConnectionID) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConnectionID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryConnectionConsensusStateResponse) 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 *QueryConnectionConsensusStateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConnectionConsensusStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ProofHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProofHeight)) + i-- + dAtA[i] = 0x28 + } + if len(m.ProofPath) > 0 { + i -= len(m.ProofPath) + copy(dAtA[i:], m.ProofPath) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ProofPath))) + i-- + dAtA[i] = 0x22 + } + 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] = 0x1a + } + 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] = 0x12 + } + if m.ConsensusState != nil { + { + size, err := m.ConsensusState.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -964,6 +1509,87 @@ func (m *QueryClientConnectionsResponse) Size() (n int) { return n } +func (m *QueryConnectionClientStateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ConnectionID) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryConnectionClientStateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.IdentifiedClientState != nil { + l = m.IdentifiedClientState.Size() + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Proof) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ProofPath) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.ProofHeight != 0 { + n += 1 + sovQuery(uint64(m.ProofHeight)) + } + return n +} + +func (m *QueryConnectionConsensusStateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ConnectionID) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + return n +} + +func (m *QueryConnectionConsensusStateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ConsensusState != nil { + l = m.ConsensusState.Size() + n += 1 + l + sovQuery(uint64(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 = len(m.ProofPath) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.ProofHeight != 0 { + n += 1 + sovQuery(uint64(m.ProofHeight)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1715,6 +2341,575 @@ func (m *QueryClientConnectionsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryConnectionClientStateRequest) 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: QueryConnectionClientStateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConnectionClientStateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnectionID", 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.ConnectionID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryConnectionClientStateResponse) 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: QueryConnectionClientStateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConnectionClientStateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IdentifiedClientState", 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 m.IdentifiedClientState == nil { + m.IdentifiedClientState = &types.IdentifiedClientState{} + } + if err := m.IdentifiedClientState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 ProofPath", 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.ProofPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType) + } + m.ProofHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProofHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryConnectionConsensusStateRequest) 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: QueryConnectionConsensusStateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConnectionConsensusStateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnectionID", 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.ConnectionID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryConnectionConsensusStateResponse) 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: QueryConnectionConsensusStateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConnectionConsensusStateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsensusState", 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 m.ConsensusState == nil { + m.ConsensusState = &types1.Any{} + } + if err := m.ConsensusState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + 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 3: + 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 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofPath", 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.ProofPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType) + } + m.ProofHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProofHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (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/x/ibc/04-channel/client/utils/utils.go b/x/ibc/04-channel/client/utils/utils.go index 243011dfdd..ae06f80cb8 100644 --- a/x/ibc/04-channel/client/utils/utils.go +++ b/x/ibc/04-channel/client/utils/utils.go @@ -139,13 +139,14 @@ func QueryChannelClientState( // prove is true, it performs an ABCI store query in order to retrieve the // merkle proof. Otherwise, it uses the gRPC query client. func QueryChannelConsensusState( - clientCtx client.Context, portID, channelID string, prove bool, + clientCtx client.Context, portID, channelID string, height uint64, prove bool, ) (*types.QueryChannelConsensusStateResponse, error) { queryClient := types.NewQueryClient(clientCtx) req := &types.QueryChannelConsensusStateRequest{ PortID: portID, ChannelID: channelID, + Height: height, } res, err := queryClient.ChannelConsensusState(context.Background(), req) @@ -179,7 +180,7 @@ func QueryChannelConsensusState( // QueryCounterpartyConsensusState uses the channel Querier to return the // counterparty ConsensusState given the source port ID and source channel ID. func QueryCounterpartyConsensusState( - clientCtx client.Context, portID, channelID string, + clientCtx client.Context, portID, channelID string, height uint64, ) (clientexported.ConsensusState, uint64, error) { channelRes, err := QueryChannel(clientCtx, portID, channelID, false) if err != nil { @@ -187,7 +188,7 @@ func QueryCounterpartyConsensusState( } counterparty := channelRes.Channel.Counterparty - res, err := QueryChannelConsensusState(clientCtx, counterparty.PortID, counterparty.ChannelID, false) + res, err := QueryChannelConsensusState(clientCtx, counterparty.PortID, counterparty.ChannelID, height, false) if err != nil { return nil, 0, err } diff --git a/x/ibc/04-channel/keeper/grpc_query_test.go b/x/ibc/04-channel/keeper/grpc_query_test.go index 6e81e23317..726fdfb7df 100644 --- a/x/ibc/04-channel/keeper/grpc_query_test.go +++ b/x/ibc/04-channel/keeper/grpc_query_test.go @@ -332,7 +332,8 @@ func (suite *KeeperTestSuite) TestQueryChannelClientState() { }, false, }, - {"channel not found", + { + "channel not found", func() { req = &types.QueryChannelClientStateRequest{ PortID: "test-port-id", @@ -454,7 +455,8 @@ func (suite *KeeperTestSuite) TestQueryChannelConsensusState() { }, false, }, - {"channel not found", + { + "channel not found", func() { req = &types.QueryChannelConsensusStateRequest{ PortID: "test-port-id", diff --git a/x/ibc/keeper/grpc_query.go b/x/ibc/keeper/grpc_query.go index f72c2e2164..8241091de1 100644 --- a/x/ibc/keeper/grpc_query.go +++ b/x/ibc/keeper/grpc_query.go @@ -22,6 +22,16 @@ func (q Keeper) ClientConnections(c context.Context, req *connectiontypes.QueryC return q.ConnectionKeeper.ClientConnections(c, req) } +// ConnectionClientState implements the IBC QueryServer interface +func (q Keeper) ConnectionClientState(c context.Context, req *connectiontypes.QueryConnectionClientStateRequest) (*connectiontypes.QueryConnectionClientStateResponse, error) { + return q.ConnectionKeeper.ConnectionClientState(c, req) +} + +// ConnectionConsensusState implements the IBC QueryServer interface +func (q Keeper) ConnectionConsensusState(c context.Context, req *connectiontypes.QueryConnectionConsensusStateRequest) (*connectiontypes.QueryConnectionConsensusStateResponse, error) { + return q.ConnectionKeeper.ConnectionConsensusState(c, req) +} + // Channel implements the IBC QueryServer interface func (q Keeper) Channel(c context.Context, req *channeltypes.QueryChannelRequest) (*channeltypes.QueryChannelResponse, error) { return q.ChannelKeeper.Channel(c, req)