From aaa545dc936cb3b56adebdef327dbedc45066315 Mon Sep 17 00:00:00 2001 From: yaruwangway <69694322+yaruwangway@users.noreply.github.com> Date: Wed, 9 Aug 2023 10:45:26 +0200 Subject: [PATCH] feat: add provider info query (#1164) * feat: add provider info query * feat: refactor query providerInfo * feat: query provider info * feat: query all provider info * feat: add provider info query cli * feat: add consumer info to provider info query * feat: add consumer chain-id to provider info query * fix: return err when client, channel not found * fix: lint * chore: fix lint * chore: lint fix * chore: add nonlint * chore: add nonlint to the right place * chore: add nolint nolintlint * chore: nolint all * chore: nolint:golint * chore: fix package import order * chore: update queryProviderChainInfo to queryProviderInfo * chore: update proto * update query.go * docs: update changelog --- CHANGELOG.md | 1 + .../ccv/consumer/v1/query.proto | 18 + testutil/keeper/mocks.go | 10 + x/ccv/consumer/client/cli/query.go | 32 +- x/ccv/consumer/keeper/grpc_query.go | 17 +- x/ccv/consumer/keeper/provider_info.go | 54 ++ x/ccv/consumer/types/query.pb.go | 780 +++++++++++++++++- x/ccv/consumer/types/query.pb.gw.go | 65 ++ x/ccv/types/expected_keepers.go | 1 + 9 files changed, 940 insertions(+), 38 deletions(-) create mode 100644 x/ccv/consumer/keeper/provider_info.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 818bdca374..5003260943 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Add an entry to the unreleased section whenever merging a PR to main that is not * (fix!) revert consumer packet data changes from #1037 [#1150](https://github.com/cosmos/interchain-security/pull/1150) * (fix!) proper deletion of pending packets [#1146](https://github.com/cosmos/interchain-security/pull/1146) * (feat!) optimize pending packets storage on consumer, with migration! [#1037](https://github.com/cosmos/interchain-security/pull/1037) +* (feat) introduce the gRPC query `/interchain_security/ccv/consumer/provider-info` and CLI command `interchain-security-cd q ccvconsumer provider-info`to retrieve provider info from the consumer chain. ## v3.1.0 diff --git a/proto/interchain_security/ccv/consumer/v1/query.proto b/proto/interchain_security/ccv/consumer/v1/query.proto index df90b1d0aa..43a7b0bccc 100644 --- a/proto/interchain_security/ccv/consumer/v1/query.proto +++ b/proto/interchain_security/ccv/consumer/v1/query.proto @@ -19,6 +19,10 @@ service Query { rpc QueryParams(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/interchain_security/ccv/consumer/params"; } + + rpc QueryProviderInfo(QueryProviderInfoRequest) returns (QueryProviderInfoResponse) { + option (google.api.http).get = "/interchain_security/ccv/consumer/provider-info"; + } } // NextFeeDistributionEstimate holds information about next fee distribution @@ -52,3 +56,17 @@ message QueryParamsResponse { // params holds all the parameters of this module. Params params = 1 [ (gogoproto.nullable) = false ]; } + +message QueryProviderInfoRequest {} + +message QueryProviderInfoResponse { + ChainInfo consumer = 1 [ (gogoproto.nullable) = false ]; + ChainInfo provider = 2 [ (gogoproto.nullable) = false ]; +} + +message ChainInfo { + string chainID = 1; + string clientID = 2; + string connectionID = 3; + string channelID = 4; +} diff --git a/testutil/keeper/mocks.go b/testutil/keeper/mocks.go index fea83079d3..b075819cc4 100644 --- a/testutil/keeper/mocks.go +++ b/testutil/keeper/mocks.go @@ -564,6 +564,16 @@ func (m *MockChannelKeeper) GetChannel(ctx types0.Context, srcPort, srcChan stri return ret0, ret1 } +func (m *MockChannelKeeper) GetChannelConnection(ctx types0.Context, portID, channelID string) (string, exported.ConnectionI, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetChannelConnection", ctx, portID, channelID) + ret0, _ := ret[0].(string) + ret1, _ := ret[0].(exported.ConnectionI) + ret2, _ := ret[1].(error) + + return ret0, ret1, ret2 +} + // GetChannel indicates an expected call of GetChannel. func (mr *MockChannelKeeperMockRecorder) GetChannel(ctx, srcPort, srcChan interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() diff --git a/x/ccv/consumer/client/cli/query.go b/x/ccv/consumer/client/cli/query.go index a961b9642c..dc1ecfc2f4 100644 --- a/x/ccv/consumer/client/cli/query.go +++ b/x/ccv/consumer/client/cli/query.go @@ -19,7 +19,10 @@ func NewQueryCmd() *cobra.Command { RunE: client.ValidateCmd, } - cmd.AddCommand(CmdNextFeeDistribution()) + cmd.AddCommand( + CmdNextFeeDistribution(), + CmdProviderInfo(), + ) return cmd } @@ -50,3 +53,30 @@ func CmdNextFeeDistribution() *cobra.Command { return cmd } + +func CmdProviderInfo() *cobra.Command { + cmd := &cobra.Command{ + Use: "provider-info", + Short: "Query provider info", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + req := &types.QueryProviderInfoRequest{} + res, err := queryClient.QueryProviderInfo(cmd.Context(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/ccv/consumer/keeper/grpc_query.go b/x/ccv/consumer/keeper/grpc_query.go index 174f591497..80e6b695a9 100644 --- a/x/ccv/consumer/keeper/grpc_query.go +++ b/x/ccv/consumer/keeper/grpc_query.go @@ -11,9 +11,9 @@ import ( "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" ) -var _ types.QueryServer = Keeper{} +var _ types.QueryServer = Keeper{} //nolint:golint -func (k Keeper) QueryNextFeeDistribution(c context.Context, +func (k Keeper) QueryNextFeeDistribution(c context.Context, //nolint:golint req *types.QueryNextFeeDistributionEstimateRequest, ) (*types.QueryNextFeeDistributionEstimateResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -27,7 +27,7 @@ func (k Keeper) QueryNextFeeDistribution(c context.Context, return &types.QueryNextFeeDistributionEstimateResponse{Data: &nextDist}, nil } -func (k Keeper) QueryParams(c context.Context, +func (k Keeper) QueryParams(c context.Context, //nolint:golint req *types.QueryParamsRequest, ) (*types.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -40,3 +40,14 @@ func (k Keeper) QueryParams(c context.Context, return &types.QueryParamsResponse{Params: p}, nil } + +func (k Keeper) QueryProviderInfo(c context.Context, //nolint:golint + req *types.QueryProviderInfoRequest, +) (*types.QueryProviderInfoResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + return k.GetProviderInfo(ctx) +} diff --git a/x/ccv/consumer/keeper/provider_info.go b/x/ccv/consumer/keeper/provider_info.go new file mode 100644 index 0000000000..d8dfef100a --- /dev/null +++ b/x/ccv/consumer/keeper/provider_info.go @@ -0,0 +1,54 @@ +package keeper + +import ( + ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" //nolint:golint + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" + ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types" +) + +func (k Keeper) GetProviderInfo(ctx sdk.Context) (*types.QueryProviderInfoResponse, error) { //nolint:golint + consumerChannelID, found := k.GetProviderChannel(ctx) + if !found { + return nil, ccvtypes.ErrChannelNotFound + } + consumerChannel, found := k.channelKeeper.GetChannel(ctx, ccvtypes.ConsumerPortID, consumerChannelID) + if !found { + return nil, ccvtypes.ErrChannelNotFound + } + + // from channel get connection + consumerConnectionID, consumerConnection, err := k.channelKeeper.GetChannelConnection(ctx, ccvtypes.ConsumerPortID, consumerChannelID) + if err != nil { + return nil, err + } + + providerChannelID := consumerChannel.GetCounterparty().GetChannelID() + providerConnection := consumerConnection.GetCounterparty() + + consumerClientState, found := k.clientKeeper.GetClientState(ctx, consumerConnection.GetClientID()) + if !found { + return nil, ccvtypes.ErrClientNotFound + } + providerChainID := consumerClientState.(*ibctm.ClientState).ChainId + + resp := types.QueryProviderInfoResponse{ + Consumer: types.ChainInfo{ + ChainID: ctx.ChainID(), + ClientID: consumerConnection.GetClientID(), + ConnectionID: consumerConnectionID, + ChannelID: consumerChannelID, + }, + + Provider: types.ChainInfo{ + ChainID: providerChainID, + ClientID: providerConnection.GetClientID(), + ConnectionID: providerConnection.GetConnectionID(), + ChannelID: providerChannelID, + }, + } + + return &resp, nil +} diff --git a/x/ccv/consumer/types/query.pb.go b/x/ccv/consumer/types/query.pb.go index 5b9c52d962..effe4757ef 100644 --- a/x/ccv/consumer/types/query.pb.go +++ b/x/ccv/consumer/types/query.pb.go @@ -295,12 +295,171 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } +type QueryProviderInfoRequest struct { +} + +func (m *QueryProviderInfoRequest) Reset() { *m = QueryProviderInfoRequest{} } +func (m *QueryProviderInfoRequest) String() string { return proto.CompactTextString(m) } +func (*QueryProviderInfoRequest) ProtoMessage() {} +func (*QueryProviderInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f627751d3cc10225, []int{5} +} +func (m *QueryProviderInfoRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryProviderInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryProviderInfoRequest.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 *QueryProviderInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProviderInfoRequest.Merge(m, src) +} +func (m *QueryProviderInfoRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryProviderInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProviderInfoRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryProviderInfoRequest proto.InternalMessageInfo + +type QueryProviderInfoResponse struct { + Consumer ChainInfo `protobuf:"bytes,1,opt,name=consumer,proto3" json:"consumer"` + Provider ChainInfo `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider"` +} + +func (m *QueryProviderInfoResponse) Reset() { *m = QueryProviderInfoResponse{} } +func (m *QueryProviderInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryProviderInfoResponse) ProtoMessage() {} +func (*QueryProviderInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f627751d3cc10225, []int{6} +} +func (m *QueryProviderInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryProviderInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryProviderInfoResponse.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 *QueryProviderInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProviderInfoResponse.Merge(m, src) +} +func (m *QueryProviderInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryProviderInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProviderInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryProviderInfoResponse proto.InternalMessageInfo + +func (m *QueryProviderInfoResponse) GetConsumer() ChainInfo { + if m != nil { + return m.Consumer + } + return ChainInfo{} +} + +func (m *QueryProviderInfoResponse) GetProvider() ChainInfo { + if m != nil { + return m.Provider + } + return ChainInfo{} +} + +type ChainInfo struct { + ChainID string `protobuf:"bytes,1,opt,name=chainID,proto3" json:"chainID,omitempty"` + ClientID string `protobuf:"bytes,2,opt,name=clientID,proto3" json:"clientID,omitempty"` + ConnectionID string `protobuf:"bytes,3,opt,name=connectionID,proto3" json:"connectionID,omitempty"` + ChannelID string `protobuf:"bytes,4,opt,name=channelID,proto3" json:"channelID,omitempty"` +} + +func (m *ChainInfo) Reset() { *m = ChainInfo{} } +func (m *ChainInfo) String() string { return proto.CompactTextString(m) } +func (*ChainInfo) ProtoMessage() {} +func (*ChainInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_f627751d3cc10225, []int{7} +} +func (m *ChainInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ChainInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ChainInfo.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 *ChainInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChainInfo.Merge(m, src) +} +func (m *ChainInfo) XXX_Size() int { + return m.Size() +} +func (m *ChainInfo) XXX_DiscardUnknown() { + xxx_messageInfo_ChainInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_ChainInfo proto.InternalMessageInfo + +func (m *ChainInfo) GetChainID() string { + if m != nil { + return m.ChainID + } + return "" +} + +func (m *ChainInfo) GetClientID() string { + if m != nil { + return m.ClientID + } + return "" +} + +func (m *ChainInfo) GetConnectionID() string { + if m != nil { + return m.ConnectionID + } + return "" +} + +func (m *ChainInfo) GetChannelID() string { + if m != nil { + return m.ChannelID + } + return "" +} + func init() { proto.RegisterType((*NextFeeDistributionEstimate)(nil), "interchain_security.ccv.consumer.v1.NextFeeDistributionEstimate") proto.RegisterType((*QueryNextFeeDistributionEstimateRequest)(nil), "interchain_security.ccv.consumer.v1.QueryNextFeeDistributionEstimateRequest") proto.RegisterType((*QueryNextFeeDistributionEstimateResponse)(nil), "interchain_security.ccv.consumer.v1.QueryNextFeeDistributionEstimateResponse") proto.RegisterType((*QueryParamsRequest)(nil), "interchain_security.ccv.consumer.v1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "interchain_security.ccv.consumer.v1.QueryParamsResponse") + proto.RegisterType((*QueryProviderInfoRequest)(nil), "interchain_security.ccv.consumer.v1.QueryProviderInfoRequest") + proto.RegisterType((*QueryProviderInfoResponse)(nil), "interchain_security.ccv.consumer.v1.QueryProviderInfoResponse") + proto.RegisterType((*ChainInfo)(nil), "interchain_security.ccv.consumer.v1.ChainInfo") } func init() { @@ -308,40 +467,49 @@ func init() { } var fileDescriptor_f627751d3cc10225 = []byte{ - // 521 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0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33, 0x81, 0xfe, 0xe7, 0x1a, 0x6a, 0x98, 0x11, 0xf8, 0xa7, 0x85, - 0xec, 0xbf, 0x85, 0x80, 0x9f, 0x96, 0x9a, 0x50, 0x32, 0xef, 0xf6, 0xb3, 0xff, 0xa4, 0x96, 0xc6, - 0xd1, 0xb9, 0xf7, 0xee, 0xcb, 0x8f, 0x8f, 0xd5, 0x3b, 0x78, 0x7b, 0xfd, 0x3f, 0x38, 0x59, 0xd5, - 0xde, 0x01, 0x40, 0xaf, 0xb8, 0x88, 0xf8, 0x93, 0x85, 0x36, 0x0a, 0x39, 0xe3, 0xed, 0xf2, 0xfe, - 0x56, 0xde, 0xab, 0x7d, 0xfb, 0xdf, 0x1b, 0xb3, 0x3b, 0xdc, 0x32, 0x77, 0xb8, 0x81, 0xbb, 0xeb, - 0xef, 0x90, 0xbe, 0xdc, 0xce, 0xab, 0xa3, 0x85, 0x63, 0x1d, 0x2f, 0x1c, 0xeb, 0xfb, 0xc2, 0xb1, - 0x3e, 0x2c, 0x9d, 0xca, 0xf1, 0xd2, 0xa9, 0x7c, 0x5d, 0x3a, 0x95, 0xd7, 0x77, 0x3d, 0xae, 0x27, - 0xd1, 0xc8, 0x65, 0xc2, 0x27, 0x4c, 0x28, 0x5f, 0xa8, 0x82, 0x68, 0xef, 0x44, 0x34, 0x1e, 0x90, - 0xd9, 0xaa, 0xb2, 0x9e, 0x87, 0xa0, 0x46, 0x4d, 0xf3, 0x41, 0x19, 0xfc, 0x0a, 0x00, 0x00, 0xff, - 0xff, 0xcc, 0x57, 0x2e, 0xd6, 0x10, 0x05, 0x00, 0x00, + // 672 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x41, 0x6b, 0x13, 0x4f, + 0x14, 0xcf, 0xa6, 0x4d, 0xdb, 0xbc, 0xfe, 0xff, 0x07, 0xc7, 0x08, 0xeb, 0x5a, 0xd6, 0xb2, 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 0x5c, 0x3d, 0xa2, 0xac, 0xdd, 0x51, 0xb6, 0x35, 0x6b, 0xd5, 0xc7, 0xc2, 0x51, + 0x23, 0x72, 0x01, 0xba, 0x58, 0x66, 0x2e, 0x65, 0xed, 0x92, 0xb3, 0x24, 0x38, 0xa7, 0xdb, 0x19, + 0x3e, 0x96, 0xe2, 0x87, 0x16, 0xb4, 0x00, 0x17, 0x36, 0x72, 0xd9, 0xd7, 0x36, 0x23, 0x4c, 0x92, + 0x0f, 0x7b, 0x7c, 0xd6, 0xaa, 0x57, 0xc3, 0x5a, 0x1e, 0x5c, 0x31, 0x18, 0xaa, 0x41, 0x45, 0x09, + 0x85, 0xbb, 0x76, 0x45, 0x3b, 0xa5, 0x87, 0x24, 0x95, 0x12, 0xab, 0x91, 0x18, 0xb0, 0x0d, 0x1a, + 0xd9, 0x13, 0x1a, 0xca, 0x59, 0x52, 0x7c, 0xd9, 0x34, 0xc1, 0x9e, 0xcc, 0xf0, 0xcc, 0xe2, 0x5d, + 0x87, 0x6b, 0xcf, 0x92, 0xcb, 0x3a, 0xa1, 0x29, 0x21, 0xdd, 0x8a, 0xa9, 0x54, 0xde, 0x6b, 0x0b, + 0xea, 0xa7, 0xfb, 0xca, 0xbe, 0xe0, 0x92, 0xa2, 0xe7, 0x30, 0xbe, 0x81, 0x15, 0xd6, 0xfd, 0x9b, + 0x9e, 0xbf, 0xef, 0x17, 0x18, 0x02, 0xff, 0x24, 0x5e, 0xcd, 0xe6, 0xd5, 0x00, 0x69, 0x05, 0xab, + 0x38, 0xc2, 0x3d, 0x99, 0x09, 0x7b, 0x05, 0xe7, 0x47, 0xac, 0x46, 0x42, 0x0b, 0x26, 0xfa, 0xda, + 0x62, 0x44, 0xdc, 0x2c, 0x24, 0x22, 0x25, 0x79, 0x30, 0xbe, 0xfb, 0xfd, 0x72, 0x29, 0x34, 0x04, + 0x9e, 0x03, 0x76, 0x9a, 0xc1, 0xb4, 0xb5, 0xc5, 0x37, 0x45, 0x96, 0xf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0x83, 0x82, 0xa3, 0x6b, 0xe5, 0xdc, 0xfd, 0xd3, 0x70, 0x53, 0xc6, 0xa2, 0x2e, 0x63, 0x0e, + 0x05, 0x05, 0xca, 0x30, 0xf1, 0x0d, 0x96, 0x6c, 0xc7, 0x8b, 0xdd, 0x7d, 0xd7, 0xda, 0xdb, 0x77, + 0xad, 0x1f, 0xfb, 0xae, 0xf5, 0xe1, 0xc0, 0x2d, 0xed, 0x1d, 0xb8, 0xa5, 0x6f, 0x07, 0x6e, 0xe9, + 0xe5, 0x52, 0x9b, 0xa9, 0x4e, 0xbc, 0xee, 0x13, 0xd1, 0x0b, 0x88, 0x90, 0x3d, 0x21, 0x73, 0xdc, + 0x8d, 0x21, 0xf7, 0x60, 0x21, 0xd8, 0x1e, 0x4d, 0xa0, 0x76, 0xfa, 0x54, 0xae, 0x4f, 0xe8, 0x5f, + 0xd0, 0xc2, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x78, 0x73, 0x9f, 0x0e, 0x42, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -361,6 +529,7 @@ type QueryClient interface { QueryNextFeeDistribution(ctx context.Context, in *QueryNextFeeDistributionEstimateRequest, opts ...grpc.CallOption) (*QueryNextFeeDistributionEstimateResponse, error) // QueryParams queries the ccv/consumer module parameters. QueryParams(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + QueryProviderInfo(ctx context.Context, in *QueryProviderInfoRequest, opts ...grpc.CallOption) (*QueryProviderInfoResponse, error) } type queryClient struct { @@ -389,6 +558,15 @@ func (c *queryClient) QueryParams(ctx context.Context, in *QueryParamsRequest, o return out, nil } +func (c *queryClient) QueryProviderInfo(ctx context.Context, in *QueryProviderInfoRequest, opts ...grpc.CallOption) (*QueryProviderInfoResponse, error) { + out := new(QueryProviderInfoResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.consumer.v1.Query/QueryProviderInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // ConsumerGenesis queries the genesis state needed to start a consumer chain @@ -396,6 +574,7 @@ type QueryServer interface { QueryNextFeeDistribution(context.Context, *QueryNextFeeDistributionEstimateRequest) (*QueryNextFeeDistributionEstimateResponse, error) // QueryParams queries the ccv/consumer module parameters. QueryParams(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + QueryProviderInfo(context.Context, *QueryProviderInfoRequest) (*QueryProviderInfoResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -408,6 +587,9 @@ func (*UnimplementedQueryServer) QueryNextFeeDistribution(ctx context.Context, r func (*UnimplementedQueryServer) QueryParams(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryParams not implemented") } +func (*UnimplementedQueryServer) QueryProviderInfo(ctx context.Context, req *QueryProviderInfoRequest) (*QueryProviderInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryProviderInfo not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -449,6 +631,24 @@ func _Query_QueryParams_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Query_QueryProviderInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryProviderInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryProviderInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.consumer.v1.Query/QueryProviderInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryProviderInfo(ctx, req.(*QueryProviderInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "interchain_security.ccv.consumer.v1.Query", HandlerType: (*QueryServer)(nil), @@ -461,6 +661,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "QueryParams", Handler: _Query_QueryParams_Handler, }, + { + MethodName: "QueryProviderInfo", + Handler: _Query_QueryProviderInfo_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "interchain_security/ccv/consumer/v1/query.proto", @@ -646,6 +850,123 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *QueryProviderInfoRequest) 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 *QueryProviderInfoRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProviderInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryProviderInfoResponse) 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 *QueryProviderInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProviderInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Provider.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Consumer.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 *ChainInfo) 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 *ChainInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ChainInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ChannelID) > 0 { + i -= len(m.ChannelID) + copy(dAtA[i:], m.ChannelID) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ChannelID))) + i-- + dAtA[i] = 0x22 + } + 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] = 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 len(m.ChainID) > 0 { + i -= len(m.ChainID) + copy(dAtA[i:], m.ChainID) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -733,6 +1054,53 @@ func (m *QueryParamsResponse) Size() (n int) { return n } +func (m *QueryProviderInfoRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryProviderInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Consumer.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.Provider.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *ChainInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainID) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ClientID) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ConnectionID) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ChannelID) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1243,6 +1611,350 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryProviderInfoRequest) 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: QueryProviderInfoRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProviderInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *QueryProviderInfoResponse) 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: QueryProviderInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProviderInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Consumer", 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.Consumer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + 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 *ChainInfo) 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: ChainInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ChainInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainID", 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.ChainID = string(dAtA[iNdEx:postIndex]) + 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 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 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", 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.ChannelID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + 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/x/ccv/consumer/types/query.pb.gw.go b/x/ccv/consumer/types/query.pb.gw.go index 2aaa7d4b49..1151ab0b60 100644 --- a/x/ccv/consumer/types/query.pb.gw.go +++ b/x/ccv/consumer/types/query.pb.gw.go @@ -69,6 +69,24 @@ func local_request_Query_QueryParams_0(ctx context.Context, marshaler runtime.Ma } +func request_Query_QueryProviderInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryProviderInfoRequest + var metadata runtime.ServerMetadata + + msg, err := client.QueryProviderInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryProviderInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryProviderInfoRequest + var metadata runtime.ServerMetadata + + msg, err := server.QueryProviderInfo(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. @@ -121,6 +139,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_QueryProviderInfo_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_QueryProviderInfo_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_QueryProviderInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -202,6 +243,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_QueryProviderInfo_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_QueryProviderInfo_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_QueryProviderInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -209,10 +270,14 @@ var ( pattern_Query_QueryNextFeeDistribution_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "consumer", "next-fee-distribution"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_QueryParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "consumer", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryProviderInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "consumer", "provider-info"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_QueryNextFeeDistribution_0 = runtime.ForwardResponseMessage forward_Query_QueryParams_0 = runtime.ForwardResponseMessage + + forward_Query_QueryProviderInfo_0 = runtime.ForwardResponseMessage ) diff --git a/x/ccv/types/expected_keepers.go b/x/ccv/types/expected_keepers.go index 2a82561cf0..2f203a47ea 100644 --- a/x/ccv/types/expected_keepers.go +++ b/x/ccv/types/expected_keepers.go @@ -82,6 +82,7 @@ type ChannelKeeper interface { ) (sequence uint64, err error) WriteAcknowledgement(ctx sdk.Context, chanCap *capabilitytypes.Capability, packet ibcexported.PacketI, acknowledgement ibcexported.Acknowledgement) error ChanCloseInit(ctx sdk.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error + GetChannelConnection(ctx sdk.Context, portID, channelID string) (string, ibcexported.ConnectionI, error) } // PortKeeper defines the expected IBC port keeper