From fa4469284bd1586ec2d850de03fd64dc9690938a Mon Sep 17 00:00:00 2001 From: bernd-m <43466467+bermuell@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:04:42 +0100 Subject: [PATCH] feat: Added query for provider parameters (#1605) Added query for provider parameters (cherry picked from commit f5afcb78d5e89d7892b8df13ce11065c89a0a1c3) # Conflicts: # x/ccv/provider/types/query.pb.go --- .../1445-query-provider-parameters.md | 2 + .../ccv/provider/v1/query.proto | 16 +- x/ccv/provider/client/cli/query.go | 37 +- x/ccv/provider/keeper/grpc_query.go | 8 + x/ccv/provider/types/query.pb.go | 421 ++++++++++++++++++ x/ccv/provider/types/query.pb.gw.go | 65 +++ 6 files changed, 547 insertions(+), 2 deletions(-) create mode 100644 .changelog/unreleased/improvements/provider/1445-query-provider-parameters.md diff --git a/.changelog/unreleased/improvements/provider/1445-query-provider-parameters.md b/.changelog/unreleased/improvements/provider/1445-query-provider-parameters.md new file mode 100644 index 0000000000..f7ec62399d --- /dev/null +++ b/.changelog/unreleased/improvements/provider/1445-query-provider-parameters.md @@ -0,0 +1,2 @@ +- Added query for current values of all provider parameters + ([\#1605](https://github.com/cosmos/interchain-security/pull/1605)) \ No newline at end of file diff --git a/proto/interchain_security/ccv/provider/v1/query.proto b/proto/interchain_security/ccv/provider/v1/query.proto index 41d81da04d..f7d41a7715 100644 --- a/proto/interchain_security/ccv/provider/v1/query.proto +++ b/proto/interchain_security/ccv/provider/v1/query.proto @@ -99,7 +99,14 @@ service Query { returns (QueryAllPairsValConAddrByConsumerChainIDResponse) { option (google.api.http).get = "/interchain_security/ccv/provider/consumer_chain_id"; - } + } + + // QueryParams returns all current values of provider parameters + rpc QueryParams(QueryParamsRequest) + returns (QueryParamsResponse) { + option (google.api.http).get = + "/interchain_security/ccv/provider/params"; + } } message QueryConsumerGenesisRequest { string chain_id = 1; } @@ -235,3 +242,10 @@ message PairValConAddrProviderAndConsumer { string consumer_address = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ]; tendermint.crypto.PublicKey consumer_key = 3; } + +message QueryParamsRequest {} + +message QueryParamsResponse { + Params params = 1 [(gogoproto.nullable) = false]; +} + diff --git a/x/ccv/provider/client/cli/query.go b/x/ccv/provider/client/cli/query.go index a61d89949f..a0797921d5 100644 --- a/x/ccv/provider/client/cli/query.go +++ b/x/ccv/provider/client/cli/query.go @@ -35,7 +35,7 @@ func NewQueryCmd() *cobra.Command { cmd.AddCommand(CmdRegisteredConsumerRewardDenoms()) cmd.AddCommand(CmdProposedConsumerChains()) cmd.AddCommand(CmdAllPairsValConAddrByConsumerChainID()) - + cmd.AddCommand(CmdProviderParameters()) return cmd } @@ -412,3 +412,38 @@ func CmdAllPairsValConAddrByConsumerChainID() *cobra.Command { return cmd } + +// Command to query provider parameters +func CmdProviderParameters() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "Query provider parameters information", + Long: strings.TrimSpace( + fmt.Sprintf(`Query parameter values of provider. +Example: +$ %s query provider params + `, version.AppName), + ), + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.QueryParams(cmd.Context(), + &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(&res.Params) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd + +} diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index a9680aec44..764d03f193 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -298,3 +298,11 @@ func (k Keeper) QueryAllPairsValConAddrByConsumerChainID(goCtx context.Context, PairValConAddr: pairValConAddrs, }, nil } + +// QueryParams returns all parameters and current values of provider +func (k Keeper) QueryParams(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + params := k.GetParams(ctx) + + return &types.QueryParamsResponse{Params: params}, nil +} diff --git a/x/ccv/provider/types/query.pb.go b/x/ccv/provider/types/query.pb.go index afb2802eb1..7ab765455c 100644 --- a/x/ccv/provider/types/query.pb.go +++ b/x/ccv/provider/types/query.pb.go @@ -1331,6 +1331,86 @@ func (m *PairValConAddrProviderAndConsumer) GetConsumerKey() *crypto.PublicKey { return nil } +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_422512d7b7586cd7, []int{23} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.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 *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +type QueryParamsResponse struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_422512d7b7586cd7, []int{24} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.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 *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + func init() { proto.RegisterType((*QueryConsumerGenesisRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerGenesisRequest") proto.RegisterType((*QueryConsumerGenesisResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerGenesisResponse") @@ -1359,6 +1439,8 @@ func init() { proto.RegisterType((*QueryAllPairsValConAddrByConsumerChainIDRequest)(nil), "interchain_security.ccv.provider.v1.QueryAllPairsValConAddrByConsumerChainIDRequest") proto.RegisterType((*QueryAllPairsValConAddrByConsumerChainIDResponse)(nil), "interchain_security.ccv.provider.v1.QueryAllPairsValConAddrByConsumerChainIDResponse") proto.RegisterType((*PairValConAddrProviderAndConsumer)(nil), "interchain_security.ccv.provider.v1.PairValConAddrProviderAndConsumer") + proto.RegisterType((*QueryParamsRequest)(nil), "interchain_security.ccv.provider.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "interchain_security.ccv.provider.v1.QueryParamsResponse") } func init() { @@ -1366,6 +1448,7 @@ func init() { } var fileDescriptor_422512d7b7586cd7 = []byte{ +<<<<<<< HEAD // 1336 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcf, 0x6f, 0xdc, 0x44, 0x14, 0x8e, 0x93, 0xb6, 0x24, 0x93, 0xfe, 0x62, 0x5a, 0x4a, 0xea, 0x86, 0xdd, 0xd6, 0x15, 0x90, @@ -1451,6 +1534,97 @@ var fileDescriptor_422512d7b7586cd7 = []byte{ 0x52, 0x33, 0x6c, 0xc2, 0x6a, 0x84, 0xb5, 0xe1, 0xbf, 0x97, 0xe0, 0x37, 0xe6, 0x8d, 0x07, 0x1d, 0xb7, 0xaf, 0x19, 0x60, 0xb6, 0xbe, 0x4f, 0x7c, 0x6a, 0xcd, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x6d, 0xa5, 0x22, 0x70, 0x1c, 0x14, 0x00, 0x00, +======= + // 1403 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0x4f, 0x73, 0x14, 0xc5, + 0x1b, 0xce, 0x24, 0x90, 0x5f, 0xd2, 0xe1, 0xdf, 0xaf, 0x89, 0x18, 0x86, 0xb8, 0x0b, 0x43, 0xa9, + 0x01, 0x74, 0x26, 0x59, 0xb4, 0xe4, 0x8f, 0x21, 0xec, 0x26, 0x80, 0x5b, 0x81, 0x22, 0x0e, 0x88, + 0x55, 0x6a, 0xb9, 0x74, 0x66, 0xda, 0xcd, 0x14, 0xb3, 0xd3, 0x43, 0x77, 0xef, 0xc2, 0x16, 0xe5, + 0x01, 0x0f, 0xca, 0x91, 0x2a, 0xf5, 0xce, 0xc5, 0x2f, 0xe0, 0xa7, 0xe0, 0x06, 0x16, 0x17, 0x4f, + 0x68, 0x05, 0x0f, 0x96, 0x27, 0xcb, 0xbb, 0x55, 0xd6, 0xf4, 0xf4, 0xcc, 0xee, 0xec, 0x4e, 0x76, + 0x67, 0x37, 0xb9, 0x65, 0xbb, 0xfb, 0x7d, 0xde, 0xe7, 0x79, 0xbb, 0xfb, 0xed, 0x67, 0x02, 0x0c, + 0xc7, 0xe3, 0x98, 0x5a, 0x1b,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x17, 0x87, 0x07, 0x90, 0x0a, 0xcf, 0x0a, 0x85, 0xa7, 0xe1, 0xc2, 0x00, 0x0a, 0x43, 0x33, + 0x07, 0x1f, 0x8e, 0x82, 0x99, 0x2d, 0x1c, 0x1a, 0x83, 0x57, 0x87, 0x64, 0x96, 0x6a, 0x06, 0xd5, + 0x6b, 0x3b, 0x84, 0x26, 0x45, 0x7f, 0x24, 0x44, 0x97, 0xe0, 0xc5, 0x41, 0x45, 0x07, 0x9e, 0x9c, + 0xf2, 0x4a, 0xec, 0xb3, 0xe0, 0xbf, 0x0a, 0x78, 0x3d, 0xdd, 0xf0, 0x31, 0xb8, 0x3a, 0x34, 0xe9, + 0x6e, 0x67, 0xa9, 0x5e, 0xdd, 0x19, 0x30, 0x59, 0x80, 0x2b, 0xa2, 0x00, 0x45, 0xb8, 0x34, 0x44, + 0x01, 0x88, 0xdf, 0xa6, 0xff, 0xef, 0xc8, 0x53, 0xa4, 0xba, 0x33, 0x78, 0x39, 0x3b, 0xeb, 0x5e, + 0x3e, 0x53, 0xbd, 0xb2, 0x6d, 0x1c, 0x29, 0xbc, 0x28, 0x84, 0x9f, 0x87, 0x67, 0x33, 0x7c, 0x17, + 0x47, 0x40, 0x95, 0x44, 0x8b, 0x4e, 0x91, 0xdc, 0xee, 0xda, 0x86, 0x92, 0x9c, 0xe2, 0x3f, 0x87, + 0x92, 0x9c, 0x66, 0x1f, 0x87, 0x93, 0x9c, 0x78, 0xd4, 0xe0, 0x33, 0x45, 0xbe, 0x13, 0x09, 0xe7, + 0x08, 0x2f, 0x64, 0xa7, 0x98, 0x66, 0x48, 0xd5, 0xa5, 0xa1, 0xe3, 0xa5, 0xb4, 0x33, 0x42, 0x5a, + 0x01, 0xce, 0xf7, 0x97, 0xc6, 0x25, 0x40, 0xf8, 0x55, 0x0d, 0x7f, 0x1c, 0x05, 0xc7, 0x33, 0x58, + 0x41, 0x78, 0x3d, 0x3b, 0xc5, 0x4c, 0x16, 0x54, 0x5d, 0xdb,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x00, 0xff, 0xff, 0x67, 0x8a, 0xee, 0xb2, 0x49, 0x15, 0x00, 0x00, +>>>>>>> f5afcb7 (feat: Added query for provider parameters (#1605)) } // Reference imports to suppress errors if they are not otherwise used. @@ -1496,6 +1670,8 @@ type QueryClient interface { // QueryAllPairsValConAddrByConsumerChainID returns a list of pair valconsensus address // between provider and consumer chain QueryAllPairsValConAddrByConsumerChainID(ctx context.Context, in *QueryAllPairsValConAddrByConsumerChainIDRequest, opts ...grpc.CallOption) (*QueryAllPairsValConAddrByConsumerChainIDResponse, error) + // QueryParams returns all current values of provider parameters + QueryParams(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) } type queryClient struct { @@ -1605,6 +1781,15 @@ func (c *queryClient) QueryAllPairsValConAddrByConsumerChainID(ctx context.Conte return out, nil } +func (c *queryClient) QueryParams(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryParams", 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 @@ -1638,6 +1823,8 @@ type QueryServer interface { // QueryAllPairsValConAddrByConsumerChainID returns a list of pair valconsensus address // between provider and consumer chain QueryAllPairsValConAddrByConsumerChainID(context.Context, *QueryAllPairsValConAddrByConsumerChainIDRequest) (*QueryAllPairsValConAddrByConsumerChainIDResponse, error) + // QueryParams returns all current values of provider parameters + QueryParams(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1677,6 +1864,9 @@ func (*UnimplementedQueryServer) QueryProposedConsumerChainIDs(ctx context.Conte func (*UnimplementedQueryServer) QueryAllPairsValConAddrByConsumerChainID(ctx context.Context, req *QueryAllPairsValConAddrByConsumerChainIDRequest) (*QueryAllPairsValConAddrByConsumerChainIDResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryAllPairsValConAddrByConsumerChainID not implemented") } +func (*UnimplementedQueryServer) QueryParams(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryParams not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1880,6 +2070,24 @@ func _Query_QueryAllPairsValConAddrByConsumerChainID_Handler(srv interface{}, ct return interceptor(ctx, in, info, handler) } +func _Query_QueryParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryParams(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "interchain_security.ccv.provider.v1.Query", HandlerType: (*QueryServer)(nil), @@ -1928,6 +2136,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "QueryAllPairsValConAddrByConsumerChainID", Handler: _Query_QueryAllPairsValConAddrByConsumerChainID_Handler, }, + { + MethodName: "QueryParams", + Handler: _Query_QueryParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "interchain_security/ccv/provider/v1/query.proto", @@ -2883,6 +3095,62 @@ func (m *PairValConAddrProviderAndConsumer) MarshalToSizedBuffer(dAtA []byte) (i return len(dAtA) - i, nil } +func (m *QueryParamsRequest) 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 *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.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 @@ -3292,6 +3560,26 @@ func (m *PairValConAddrProviderAndConsumer) Size() (n int) { return n } +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -5716,6 +6004,139 @@ func (m *PairValConAddrProviderAndConsumer) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryParamsRequest) 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: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: 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 *QueryParamsResponse) 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: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", 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.Params.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 skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ccv/provider/types/query.pb.gw.go b/x/ccv/provider/types/query.pb.gw.go index e3663ede15..5e8b514a9e 100644 --- a/x/ccv/provider/types/query.pb.gw.go +++ b/x/ccv/provider/types/query.pb.gw.go @@ -339,6 +339,24 @@ func local_request_Query_QueryAllPairsValConAddrByConsumerChainID_0(ctx context. } +func request_Query_QueryParams_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.QueryParams(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryParams_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.QueryParams(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. @@ -598,6 +616,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_QueryParams_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_QueryParams_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_QueryParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -859,6 +900,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_QueryParams_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_QueryParams_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_QueryParams_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -884,6 +945,8 @@ var ( pattern_Query_QueryProposedConsumerChainIDs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "provider", "proposed_consumer_chains"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_QueryAllPairsValConAddrByConsumerChainID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "provider", "consumer_chain_id"}, "", 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", "provider", "params"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -908,4 +971,6 @@ var ( forward_Query_QueryProposedConsumerChainIDs_0 = runtime.ForwardResponseMessage forward_Query_QueryAllPairsValConAddrByConsumerChainID_0 = runtime.ForwardResponseMessage + + forward_Query_QueryParams_0 = runtime.ForwardResponseMessage )