From ee5c6f61507cd66854e497aec9c7eaa1b3718310 Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Fri, 21 Jul 2023 13:28:09 +0200 Subject: [PATCH 01/21] feat: add provider info query --- .../ccv/consumer/v1/query.proto | 10 + x/ccv/consumer/keeper/grpc_query.go | 26 +- x/ccv/consumer/types/query.pb.go | 398 ++++++++++++++++-- x/ccv/consumer/types/query.pb.gw.go | 65 +++ 4 files changed, 464 insertions(+), 35 deletions(-) diff --git a/proto/interchain_security/ccv/consumer/v1/query.proto b/proto/interchain_security/ccv/consumer/v1/query.proto index df90b1d0aa..f754d6324b 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 QueryProviderChainInfo(QueryProviderInfoRequest) returns (QueryProviderInfoResponse) { + option (google.api.http).get = "/interchain_security/ccv/consumer/provider-info"; + } } // NextFeeDistributionEstimate holds information about next fee distribution @@ -52,3 +56,9 @@ message QueryParamsResponse { // params holds all the parameters of this module. Params params = 1 [ (gogoproto.nullable) = false ]; } + +message QueryProviderInfoRequest {} + +message QueryProviderInfoResponse { + string ChainID = 1; +} diff --git a/x/ccv/consumer/keeper/grpc_query.go b/x/ccv/consumer/keeper/grpc_query.go index 174f591497..b60401d931 100644 --- a/x/ccv/consumer/keeper/grpc_query.go +++ b/x/ccv/consumer/keeper/grpc_query.go @@ -7,7 +7,7 @@ import ( "google.golang.org/grpc/status" sdk "github.com/cosmos/cosmos-sdk/types" - + ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" ) @@ -40,3 +40,27 @@ func (k Keeper) QueryParams(c context.Context, return &types.QueryParamsResponse{Params: p}, nil } + +func (k Keeper) QueryProviderChainInfo(c context.Context, + req *types.QueryProviderInfoRequest, +) (*types.QueryProviderInfoResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + providerClientID, found := k.GetProviderClientID(ctx) + if !found { + return nil, nil + } + clientState, found := k.clientKeeper.GetClientState(ctx, providerClientID) + if !found { + return nil, nil + } + providerChainID := clientState.(*ibctm.ClientState).ChainId + resp := types.QueryProviderInfoResponse{ + ChainID: providerChainID, + } + + return &resp, nil +} diff --git a/x/ccv/consumer/types/query.pb.go b/x/ccv/consumer/types/query.pb.go index 5b9c52d962..3f7cac0c74 100644 --- a/x/ccv/consumer/types/query.pb.go +++ b/x/ccv/consumer/types/query.pb.go @@ -295,12 +295,94 @@ 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 { + ChainID string `protobuf:"bytes,1,opt,name=ChainID,proto3" json:"ChainID,omitempty"` +} + +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) GetChainID() string { + if m != nil { + return m.ChainID + } + 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") } func init() { @@ -308,40 +390,45 @@ func init() { } var fileDescriptor_f627751d3cc10225 = []byte{ - // 521 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcf, 0x8b, 0xd3, 0x40, - 0x14, 0x6e, 0xfa, 0x4b, 0x9c, 0xc5, 0xcb, 0x58, 0x21, 0x54, 0x89, 0x4b, 0x15, 0xac, 0x4a, 0x33, - 0x6e, 0x7b, 0x58, 0x3d, 0x88, 0xb2, 0xea, 0xa2, 0xa0, 0xb2, 0x16, 0x41, 0xf0, 0xb2, 0x4e, 0xa7, - 0x6f, 0xd3, 0x81, 0x26, 0x93, 0x9d, 0x99, 0x84, 0xf6, 0x26, 0xfe, 0x01, 0x22, 0xf8, 0x9f, 0x78, - 0xf1, 0x5f, 0xd8, 0xe3, 0x82, 0x17, 0x4f, 0x22, 0xad, 0x7f, 0x84, 0x47, 0xc9, 0x24, 0x59, 0x53, - 0xd0, 0x6d, 0x04, 0x6f, 0xd3, 0xef, 0x7b, 0xef, 0x7b, 0xdf, 0x7c, 0xf3, 0x1a, 0x44, 0x78, 0xa0, - 0x41, 0xb2, 0x09, 0xe5, 0xc1, 0xbe, 0x02, 0x16, 0x49, 0xae, 0xe7, 0x84, 0xb1, 0x98, 0x30, 0x11, - 0xa8, 0xc8, 0x07, 0x49, 0xe2, 0x2d, 0x72, 0x18, 0x81, 0x9c, 0xbb, 0xa1, 0x14, 0x5a, 0xe0, 0x2b, - 0x7f, 0x68, 0x70, 0x19, 0x8b, 0xdd, 0xbc, 0xc1, 0x8d, 0xb7, 0xda, 0x2d, 0x4f, 0x78, 0xc2, 0xd4, - 0x93, 0xe4, 0x94, 0xb6, 0xb6, 0x2f, 0x79, 0x42, 0x78, 0x53, 0x20, 0x34, 0xe4, 0x84, 0x06, 0x81, - 0xd0, 0x54, 0x73, 0x11, 0xa8, 0x8c, 0xed, 0x97, 0x71, 0x72, 0x32, 0xc4, 0xf4, 0x74, 0xde, 0x57, - 0xd1, 0xc5, 0xe7, 0x30, 0xd3, 0xbb, 0x00, 0x0f, 0xb9, 0xd2, 0x92, 0x8f, 0xa2, 0x44, 0xf2, 0x91, - 0xd2, 0xdc, 0xa7, 0x1a, 0xf0, 0x55, 0x74, 0x8e, 0x45, 0x52, 0x42, 0xa0, 0x1f, 0x03, 0xf7, 0x26, - 0xda, 0xb6, 0x36, 0xad, 0x6e, 0x6d, 0xb8, 0x0a, 0x62, 0x07, 0xa1, 0x29, 0x55, 0x79, 0x49, 0xd5, - 0x94, 0x14, 0x90, 0x84, 0x0f, 0x60, 0x96, 0xf3, 0xb5, 0x94, 0xff, 0x8d, 0xe0, 0x01, 0xba, 0x30, - 0x2e, 0x4c, 0xdf, 0x3f, 0x90, 0x94, 0x25, 0x07, 0xbb, 0xbe, 0x69, 0x75, 0xcf, 0x0e, 0x5b, 0x45, - 0x72, 0x37, 0xe3, 0x70, 0x0b, 0x35, 0xb4, 0xd0, 0x74, 0x6a, 0x37, 0x4c, 0x51, 0xfa, 0x23, 0x19, - 0xa5, 0xc5, 0x9e, 0x14, 0x31, 0x1f, 0x83, 0xb4, 0x9b, 0x86, 0x2a, 0x20, 0x29, 0xff, 0x20, 0x0b, - 0xc1, 0x3e, 0x93, 0xf3, 0x39, 0xd2, 0xb9, 0x8e, 0xae, 0xbd, 0x48, 0x1e, 0xeb, 0x94, 0x50, 0x86, - 0x70, 0x18, 0x81, 0xd2, 0x9d, 0xb7, 0x16, 0xea, 0xae, 0xaf, 0x55, 0xa1, 0x08, 0x14, 0xe0, 0x97, - 0xa8, 0x3e, 0xa6, 0x9a, 0x9a, 0xfc, 0x36, 0xfa, 0xf7, 0xdd, 0x12, 0x4b, 0xe0, 0x9e, 0xa6, 0x6b, - 0xd4, 0x3a, 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, + // 593 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xc1, 0x6b, 0x13, 0x4f, + 0x14, 0xce, 0xb6, 0x4d, 0x4b, 0xa7, 0xfc, 0x2e, 0xf3, 0x8b, 0xb2, 0xae, 0xb2, 0x96, 0x55, 0x30, + 0x2a, 0xd9, 0x35, 0x09, 0x12, 0x3d, 0x54, 0xa5, 0xad, 0xc5, 0x80, 0x4a, 0x0d, 0x82, 0xe0, 0xa5, + 0x4e, 0x36, 0x93, 0xcd, 0x40, 0x32, 0x93, 0xce, 0xcc, 0x2e, 0xc9, 0x4d, 0x3c, 0x7a, 0x10, 0xc1, + 0xff, 0xc4, 0xbf, 0xa2, 0xc7, 0x80, 0x17, 0x4f, 0x22, 0x89, 0x7f, 0x84, 0x47, 0xd9, 0xd9, 0xd9, + 0xba, 0xc1, 0xd0, 0x6c, 0xc5, 0xdb, 0xee, 0xfb, 0xde, 0xfb, 0xde, 0xf7, 0xbd, 0xf7, 0x18, 0xe0, + 0x11, 0x2a, 0x31, 0xf7, 0x7b, 0x88, 0xd0, 0x23, 0x81, 0xfd, 0x90, 0x13, 0x39, 0xf6, 0x7c, 0x3f, + 0xf2, 0x7c, 0x46, 0x45, 0x38, 0xc0, 0xdc, 0x8b, 0xaa, 0xde, 0x71, 0x88, 0xf9, 0xd8, 0x1d, 0x72, + 0x26, 0x19, 0xbc, 0xb6, 0xa0, 0xc0, 0xf5, 0xfd, 0xc8, 0x4d, 0x0b, 0xdc, 0xa8, 0x6a, 0x95, 0x02, + 0x16, 0x30, 0x95, 0xef, 0xc5, 0x5f, 0x49, 0xa9, 0x75, 0x25, 0x60, 0x2c, 0xe8, 0x63, 0x0f, 0x0d, + 0x89, 0x87, 0x28, 0x65, 0x12, 0x49, 0xc2, 0xa8, 0xd0, 0x68, 0x2d, 0x8f, 0x92, 0xd3, 0x26, 0xaa, + 0xc6, 0xf9,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, 0xe1, 0xeb, 0xcc, + 0x2e, 0xbc, 0xde, 0x09, 0x88, 0xec, 0x85, 0x6d, 0xd7, 0x67, 0x03, 0xcf, 0x67, 0x62, 0xc0, 0x44, + 0x86, 0xbb, 0x72, 0xca, 0x1d, 0xd5, 0xbd, 0xd1, 0x7c, 0x03, 0x39, 0x1e, 0x62, 0xd1, 0x5e, 0x57, + 0xcf, 0x6e, 0xfd, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x77, 0xeb, 0xdd, 0xe8, 0x36, 0x06, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -361,6 +448,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) + QueryProviderChainInfo(ctx context.Context, in *QueryProviderInfoRequest, opts ...grpc.CallOption) (*QueryProviderInfoResponse, error) } type queryClient struct { @@ -389,6 +477,15 @@ func (c *queryClient) QueryParams(ctx context.Context, in *QueryParamsRequest, o return out, nil } +func (c *queryClient) QueryProviderChainInfo(ctx context.Context, in *QueryProviderInfoRequest, opts ...grpc.CallOption) (*QueryProviderInfoResponse, error) { + out := new(QueryProviderInfoResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.consumer.v1.Query/QueryProviderChainInfo", 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 +493,7 @@ type QueryServer interface { QueryNextFeeDistribution(context.Context, *QueryNextFeeDistributionEstimateRequest) (*QueryNextFeeDistributionEstimateResponse, error) // QueryParams queries the ccv/consumer module parameters. QueryParams(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + QueryProviderChainInfo(context.Context, *QueryProviderInfoRequest) (*QueryProviderInfoResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -408,6 +506,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) QueryProviderChainInfo(ctx context.Context, req *QueryProviderInfoRequest) (*QueryProviderInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryProviderChainInfo not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -449,6 +550,24 @@ func _Query_QueryParams_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Query_QueryProviderChainInfo_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).QueryProviderChainInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.consumer.v1.Query/QueryProviderChainInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryProviderChainInfo(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 +580,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "QueryParams", Handler: _Query_QueryParams_Handler, }, + { + MethodName: "QueryProviderChainInfo", + Handler: _Query_QueryProviderChainInfo_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "interchain_security/ccv/consumer/v1/query.proto", @@ -646,6 +769,59 @@ 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 + 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 +909,28 @@ 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 = len(m.ChainID) + 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 +1441,138 @@ 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 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 + 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..791849b2c8 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_QueryProviderChainInfo_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.QueryProviderChainInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryProviderChainInfo_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.QueryProviderChainInfo(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_QueryProviderChainInfo_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_QueryProviderChainInfo_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_QueryProviderChainInfo_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_QueryProviderChainInfo_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_QueryProviderChainInfo_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_QueryProviderChainInfo_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_QueryProviderChainInfo_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_QueryProviderChainInfo_0 = runtime.ForwardResponseMessage ) From 8ddb410b04260802ac385296f476b58ce47ade9b Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Fri, 28 Jul 2023 12:29:15 +0200 Subject: [PATCH 02/21] feat: refactor query providerInfo --- x/ccv/consumer/keeper/grpc_query.go | 16 +--------------- x/ccv/consumer/keeper/provider_info.go | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 x/ccv/consumer/keeper/provider_info.go diff --git a/x/ccv/consumer/keeper/grpc_query.go b/x/ccv/consumer/keeper/grpc_query.go index b60401d931..3396709566 100644 --- a/x/ccv/consumer/keeper/grpc_query.go +++ b/x/ccv/consumer/keeper/grpc_query.go @@ -7,7 +7,6 @@ import ( "google.golang.org/grpc/status" sdk "github.com/cosmos/cosmos-sdk/types" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" ) @@ -49,18 +48,5 @@ func (k Keeper) QueryProviderChainInfo(c context.Context, return nil, status.Errorf(codes.InvalidArgument, "empty request") } - providerClientID, found := k.GetProviderClientID(ctx) - if !found { - return nil, nil - } - clientState, found := k.clientKeeper.GetClientState(ctx, providerClientID) - if !found { - return nil, nil - } - providerChainID := clientState.(*ibctm.ClientState).ChainId - resp := types.QueryProviderInfoResponse{ - ChainID: providerChainID, - } - - return &resp, nil + return k.GetProviderChainInfo(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..23dc0c77eb --- /dev/null +++ b/x/ccv/consumer/keeper/provider_info.go @@ -0,0 +1,24 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" +) + +func (k Keeper) GetProviderChainInfo(ctx sdk.Context) (*types.QueryProviderInfoResponse, error) { + providerClientID, found := k.GetProviderClientID(ctx) + if !found { + return nil, nil + } + clientState, found := k.clientKeeper.GetClientState(ctx, providerClientID) + if !found { + return nil, nil + } + providerChainID := clientState.(*ibctm.ClientState).ChainId + resp := types.QueryProviderInfoResponse{ + ChainID: providerChainID, + } + + return &resp, nil +} From 81f2952fb53e3d90b7f0b9f6538f184e153909e1 Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Mon, 31 Jul 2023 16:50:08 +0200 Subject: [PATCH 03/21] feat: query provider info --- .../ccv/consumer/v1/query.proto | 3 + x/ccv/consumer/keeper/provider_info.go | 25 +- x/ccv/consumer/types/query.pb.go | 235 +++++++++++++++--- x/ccv/types/expected_keepers.go | 1 + 4 files changed, 218 insertions(+), 46 deletions(-) diff --git a/proto/interchain_security/ccv/consumer/v1/query.proto b/proto/interchain_security/ccv/consumer/v1/query.proto index f754d6324b..eb494c97b0 100644 --- a/proto/interchain_security/ccv/consumer/v1/query.proto +++ b/proto/interchain_security/ccv/consumer/v1/query.proto @@ -61,4 +61,7 @@ message QueryProviderInfoRequest {} message QueryProviderInfoResponse { string ChainID = 1; + string ClientID = 2; + string ConnectionID = 3; + string ChannelID = 4; } diff --git a/x/ccv/consumer/keeper/provider_info.go b/x/ccv/consumer/keeper/provider_info.go index 23dc0c77eb..54fb253bc9 100644 --- a/x/ccv/consumer/keeper/provider_info.go +++ b/x/ccv/consumer/keeper/provider_info.go @@ -4,20 +4,33 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" + ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types" ) func (k Keeper) GetProviderChainInfo(ctx sdk.Context) (*types.QueryProviderInfoResponse, error) { - providerClientID, found := k.GetProviderClientID(ctx) - if !found { - return nil, nil + consumerChannelID, found := k.GetProviderChannel(ctx) + consumerChannel, _ := k.channelKeeper.GetChannel(ctx, ccvtypes.ConsumerPortID, consumerChannelID) + providerChannelID := consumerChannel.GetCounterparty().GetChannelID() + + _, consumerConnection, err := k.connectionKeeper.GetChannelConnection(ctx, ccvtypes.ConsumerPortID, consumerChannelID) + if err != nil { + return nil, err } - clientState, found := k.clientKeeper.GetClientState(ctx, providerClientID) + + providerConnection := consumerConnection.GetCounterparty() + + providerClientState, found := k.clientKeeper.GetClientState(ctx, providerConnection.GetClientID()) if !found { + // todo if return err? return nil, nil } - providerChainID := clientState.(*ibctm.ClientState).ChainId + providerChainID := providerClientState.(*ibctm.ClientState).ChainId + resp := types.QueryProviderInfoResponse{ - ChainID: providerChainID, + 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 3f7cac0c74..298a996c58 100644 --- a/x/ccv/consumer/types/query.pb.go +++ b/x/ccv/consumer/types/query.pb.go @@ -332,7 +332,10 @@ func (m *QueryProviderInfoRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryProviderInfoRequest proto.InternalMessageInfo type QueryProviderInfoResponse struct { - ChainID string `protobuf:"bytes,1,opt,name=ChainID,proto3" json:"ChainID,omitempty"` + 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 *QueryProviderInfoResponse) Reset() { *m = QueryProviderInfoResponse{} } @@ -375,6 +378,27 @@ func (m *QueryProviderInfoResponse) GetChainID() string { return "" } +func (m *QueryProviderInfoResponse) GetClientID() string { + if m != nil { + return m.ClientID + } + return "" +} + +func (m *QueryProviderInfoResponse) GetConnectionID() string { + if m != nil { + return m.ConnectionID + } + return "" +} + +func (m *QueryProviderInfoResponse) 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") @@ -390,45 +414,47 @@ func init() { } var fileDescriptor_f627751d3cc10225 = []byte{ - // 593 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xc1, 0x6b, 0x13, 0x4f, - 0x14, 0xce, 0xb6, 0x4d, 0x4b, 0xa7, 0xfc, 0x2e, 0xf3, 0x8b, 0xb2, 0xae, 0xb2, 0x96, 0x55, 0x30, - 0x2a, 0xd9, 0x35, 0x09, 0x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x00, 0x00, 0xff, 0xff, 0x77, 0xeb, 0xdd, 0xe8, 0x36, 0x06, 0x00, - 0x00, + // 639 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4f, 0x4f, 0xd4, 0x4e, + 0x18, 0xde, 0x02, 0x0b, 0xbf, 0x1d, 0x7e, 0x5e, 0xc6, 0xd5, 0xd4, 0x4a, 0x2a, 0xa9, 0x26, 0xae, + 0x9a, 0x6d, 0x05, 0x0e, 0xe8, 0x01, 0x35, 0xec, 0x4a, 0x6c, 0xa2, 0x06, 0x1b, 0x13, 0x13, 0x2f, + 0x38, 0x94, 0xd9, 0xee, 0x24, 0xbb, 0x33, 0xcb, 0xcc, 0xb4, 0x81, 0x9b, 0xf1, 0xe8, 0xc1, 0x98, + 0xf0, 0x4d, 0xfc, 0x14, 0x1c, 0x49, 0xbc, 0x78, 0x32, 0x06, 0xfc, 0x10, 0x1e, 0x4d, 0xa7, 0x53, + 0x68, 0xe3, 0x86, 0x2d, 0xc6, 0x5b, 0xe7, 0x79, 0xde, 0x3f, 0xcf, 0xfb, 0xf6, 0x99, 0x01, 0x1e, + 0xa1, 0x12, 0xf3, 0xb0, 0x8f, 0x08, 0xdd, 0x12, 0x38, 0x8c, 0x39, 0x91, 0xfb, 0x5e, 0x18, 0x26, + 0x5e, 0xc8, 0xa8, 0x88, 0x87, 0x98, 0x7b, 0xc9, 0x92, 0xb7, 0x1b, 0x63, 0xbe, 0xef, 0x8e, 0x38, + 0x93, 0x0c, 0xde, 0x1c, 0x93, 0xe0, 0x86, 0x61, 0xe2, 0xe6, 0x09, 0x6e, 0xb2, 0x64, 0x35, 0x23, + 0x16, 0x31, 0x15, 0xef, 0xa5, 0x5f, 0x59, 0xaa, 0xb5, 0x10, 0x31, 0x16, 0x0d, 0xb0, 0x87, 0x46, + 0xc4, 0x43, 0x94, 0x32, 0x89, 0x24, 0x61, 0x54, 0x68, 0x76, 0xb9, 0x8a, 0x92, 0xd3, 0x26, 0x2a, + 0xc7, 0xf9, 0x34, 0x05, 0xae, 0xbf, 0xc4, 0x7b, 0x72, 0x03, 0xe3, 0x2e, 0x11, 0x92, 0x93, 0xed, + 0x38, 0x2d, 0xf9, 0x54, 0x48, 0x32, 0x44, 0x12, 0xc3, 0x5b, 0xe0, 0x52, 0x18, 0x73, 0x8e, 0xa9, + 0x7c, 0x86, 0x49, 0xd4, 0x97, 0xa6, 0xb1, 0x68, 0xb4, 0xa6, 0x83, 0x32, 0x08, 0x6d, 0x00, 0x06, + 0x48, 0xe4, 0x21, 0x53, 0x2a, 0xa4, 0x80, 0xa4, 0x3c, 0xc5, 0x7b, 0x39, 0x3f, 0x9d, 0xf1, 0x67, + 0x08, 0x5c, 0x01, 0x57, 0x76, 0x0a, 0xdd, 0xb7, 0x7a, 0x1c, 0x85, 0xe9, 0x87, 0x39, 0xb3, 0x68, + 0xb4, 0x1a, 0x41, 0xb3, 0x48, 0x6e, 0x68, 0x0e, 0x36, 0x41, 0x5d, 0x32, 0x89, 0x06, 0x66, 0x5d, + 0x05, 0x65, 0x87, 0xb4, 0x95, 0x64, 0x9b, 0x9c, 0x25, 0x64, 0x07, 0x73, 0x73, 0x56, 0x51, 0x05, + 0x24, 0xe3, 0x3b, 0x7a, 0x09, 0xe6, 0x5c, 0xce, 0xe7, 0x88, 0x73, 0x07, 0xdc, 0x7e, 0x95, 0xfe, + 0xac, 0x73, 0x96, 0x12, 0xe0, 0xdd, 0x18, 0x0b, 0xe9, 0xbc, 0x37, 0x40, 0x6b, 0x72, 0xac, 0x18, + 0x31, 0x2a, 0x30, 0x7c, 0x0d, 0x66, 0x76, 0x90, 0x44, 0x6a, 0x7f, 0xf3, 0xcb, 0x4f, 0xdc, 0x0a, + 0x26, 0x70, 0xcf, 0xab, 0xab, 0xaa, 0x39, 0x4d, 0x00, 0x95, 0x82, 0x4d, 0xc4, 0xd1, 0x50, 0xe4, + 0xc2, 0xde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x3f, 0x65, 0x86, 0xa1, 0x3d, 0x06, 0xd7, 0x2e, + 0x20, 0xe3, 0x4f, 0xa7, 0x5a, 0x8f, 0xfe, 0x36, 0x5d, 0xcf, 0xb2, 0xaa, 0x66, 0x59, 0x82, 0x5e, + 0x85, 0x59, 0x74, 0x7e, 0x9b, 0xd0, 0x1e, 0x5b, 0x7f, 0x73, 0x78, 0x6c, 0x1b, 0x47, 0xc7, 0xb6, + 0xf1, 0xe3, 0xd8, 0x36, 0x3e, 0x9f, 0xd8, 0xb5, 0xa3, 0x13, 0xbb, 0xf6, 0xed, 0xc4, 0xae, 0xbd, + 0x5d, 0x8b, 0x88, 0xec, 0xc7, 0xdb, 0x6e, 0xc8, 0x86, 0x5e, 0xc8, 0xc4, 0x90, 0x89, 0x42, 0xed, + 0xf6, 0x69, 0xed, 0x64, 0xc5, 0xdb, 0x2b, 0x37, 0x90, 0xfb, 0x23, 0x2c, 0xb6, 0x67, 0xd5, 0xab, + 0xbe, 0xf2, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xe6, 0x98, 0xdf, 0x3b, 0x95, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -812,6 +838,27 @@ func (m *QueryProviderInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = 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) @@ -928,6 +975,18 @@ func (m *QueryProviderInfoResponse) Size() (n int) { 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 } @@ -1552,6 +1611,102 @@ func (m *QueryProviderInfoResponse) Unmarshal(dAtA []byte) error { } 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:]) diff --git a/x/ccv/types/expected_keepers.go b/x/ccv/types/expected_keepers.go index 2a82561cf0..a7a60a3228 100644 --- a/x/ccv/types/expected_keepers.go +++ b/x/ccv/types/expected_keepers.go @@ -92,6 +92,7 @@ type PortKeeper interface { // ConnectionKeeper defines the expected IBC connection keeper type ConnectionKeeper interface { GetConnection(ctx sdk.Context, connectionID string) (conntypes.ConnectionEnd, bool) + GetChannelConnection(ctx sdk.Context, portID, channelID string) (string, ibcexported.ConnectionI, error) } // ClientKeeper defines the expected IBC client keeper From aeba225ffc58dfd3960ce32469f8635d8ae2ebf3 Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Tue, 1 Aug 2023 12:16:17 +0200 Subject: [PATCH 04/21] feat: query all provider info --- testutil/keeper/mocks.go | 10 ++++++++++ x/ccv/consumer/keeper/provider_info.go | 18 +++++++++++++----- x/ccv/types/expected_keepers.go | 2 +- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/testutil/keeper/mocks.go b/testutil/keeper/mocks.go index fea83079d3..64dd70445c 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/keeper/provider_info.go b/x/ccv/consumer/keeper/provider_info.go index 54fb253bc9..b4a174ad6e 100644 --- a/x/ccv/consumer/keeper/provider_info.go +++ b/x/ccv/consumer/keeper/provider_info.go @@ -8,23 +8,31 @@ import ( ) func (k Keeper) GetProviderChainInfo(ctx sdk.Context) (*types.QueryProviderInfoResponse, error) { + // get the channelID for the channel to the provider. consumerChannelID, found := k.GetProviderChannel(ctx) - consumerChannel, _ := k.channelKeeper.GetChannel(ctx, ccvtypes.ConsumerPortID, consumerChannelID) - providerChannelID := consumerChannel.GetCounterparty().GetChannelID() + if !found { + return nil, nil + } + consumerChannel, found := k.channelKeeper.GetChannel(ctx, ccvtypes.ConsumerPortID, consumerChannelID) + if !found { + return nil, nil + } - _, consumerConnection, err := k.connectionKeeper.GetChannelConnection(ctx, ccvtypes.ConsumerPortID, consumerChannelID) + // from channel get connection + _, consumerConnection, err := k.channelKeeper.GetChannelConnection(ctx, ccvtypes.ConsumerPortID, consumerChannelID) if err != nil { return nil, err } + providerChannelID := consumerChannel.GetCounterparty().GetChannelID() providerConnection := consumerConnection.GetCounterparty() - providerClientState, found := k.clientKeeper.GetClientState(ctx, providerConnection.GetClientID()) + consumerClientState, found := k.clientKeeper.GetClientState(ctx, consumerConnection.GetClientID()) if !found { // todo if return err? return nil, nil } - providerChainID := providerClientState.(*ibctm.ClientState).ChainId + providerChainID := consumerClientState.(*ibctm.ClientState).ChainId resp := types.QueryProviderInfoResponse{ ChainID: providerChainID, diff --git a/x/ccv/types/expected_keepers.go b/x/ccv/types/expected_keepers.go index a7a60a3228..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 @@ -92,7 +93,6 @@ type PortKeeper interface { // ConnectionKeeper defines the expected IBC connection keeper type ConnectionKeeper interface { GetConnection(ctx sdk.Context, connectionID string) (conntypes.ConnectionEnd, bool) - GetChannelConnection(ctx sdk.Context, portID, channelID string) (string, ibcexported.ConnectionI, error) } // ClientKeeper defines the expected IBC client keeper From 9c235c653e43af2e76784fe5a250850e3872186a Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Thu, 3 Aug 2023 14:23:11 +0200 Subject: [PATCH 05/21] feat: add provider info query cli --- x/ccv/consumer/client/cli/query.go | 32 +++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/x/ccv/consumer/client/cli/query.go b/x/ccv/consumer/client/cli/query.go index a961b9642c..4f3fbada84 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.QueryProviderChainInfo(cmd.Context(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} From bcd1ac6889574b4123c2320b76eb898d5668e1bd Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Thu, 3 Aug 2023 17:01:01 +0200 Subject: [PATCH 06/21] feat: add consumer info to provider info query --- .../ccv/consumer/v1/query.proto | 5 + x/ccv/consumer/keeper/provider_info.go | 19 +- x/ccv/consumer/types/query.pb.go | 325 +++++++++++++++--- 3 files changed, 295 insertions(+), 54 deletions(-) diff --git a/proto/interchain_security/ccv/consumer/v1/query.proto b/proto/interchain_security/ccv/consumer/v1/query.proto index eb494c97b0..0c4f5e3ef9 100644 --- a/proto/interchain_security/ccv/consumer/v1/query.proto +++ b/proto/interchain_security/ccv/consumer/v1/query.proto @@ -60,6 +60,11 @@ message QueryParamsResponse { 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; diff --git a/x/ccv/consumer/keeper/provider_info.go b/x/ccv/consumer/keeper/provider_info.go index b4a174ad6e..67bf918bfd 100644 --- a/x/ccv/consumer/keeper/provider_info.go +++ b/x/ccv/consumer/keeper/provider_info.go @@ -19,7 +19,7 @@ func (k Keeper) GetProviderChainInfo(ctx sdk.Context) (*types.QueryProviderInfoR } // from channel get connection - _, consumerConnection, err := k.channelKeeper.GetChannelConnection(ctx, ccvtypes.ConsumerPortID, consumerChannelID) + consumerConnectionID, consumerConnection, err := k.channelKeeper.GetChannelConnection(ctx, ccvtypes.ConsumerPortID, consumerChannelID) if err != nil { return nil, err } @@ -35,10 +35,19 @@ func (k Keeper) GetProviderChainInfo(ctx sdk.Context) (*types.QueryProviderInfoR providerChainID := consumerClientState.(*ibctm.ClientState).ChainId resp := types.QueryProviderInfoResponse{ - ChainID: providerChainID, - ClientID: providerConnection.GetClientID(), - ConnectionID: providerConnection.GetConnectionID(), - ChannelID: providerChannelID, + Consumer: types.ChainInfo{ + 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 298a996c58..36fd41f936 100644 --- a/x/ccv/consumer/types/query.pb.go +++ b/x/ccv/consumer/types/query.pb.go @@ -332,10 +332,8 @@ func (m *QueryProviderInfoRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryProviderInfoRequest proto.InternalMessageInfo type QueryProviderInfoResponse 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"` + 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{} } @@ -371,28 +369,82 @@ func (m *QueryProviderInfoResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryProviderInfoResponse proto.InternalMessageInfo -func (m *QueryProviderInfoResponse) GetChainID() string { +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 *QueryProviderInfoResponse) GetClientID() string { +func (m *ChainInfo) GetClientID() string { if m != nil { return m.ClientID } return "" } -func (m *QueryProviderInfoResponse) GetConnectionID() string { +func (m *ChainInfo) GetConnectionID() string { if m != nil { return m.ConnectionID } return "" } -func (m *QueryProviderInfoResponse) GetChannelID() string { +func (m *ChainInfo) GetChannelID() string { if m != nil { return m.ChannelID } @@ -407,6 +459,7 @@ func init() { 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() { @@ -414,47 +467,49 @@ func init() { } var fileDescriptor_f627751d3cc10225 = []byte{ - // 639 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4f, 0x4f, 0xd4, 0x4e, - 0x18, 0xde, 0x02, 0x0b, 0xbf, 0x1d, 0x7e, 0x5e, 0xc6, 0xd5, 0xd4, 0x4a, 0x2a, 0xa9, 0x26, 0xae, - 0x9a, 0x6d, 0x05, 0x0e, 0xe8, 0x01, 0x35, 0xec, 0x4a, 0x6c, 0xa2, 0x06, 0x1b, 0x13, 0x13, 0x2f, - 0x38, 0x94, 0xd9, 0xee, 0x24, 0xbb, 0x33, 0xcb, 0xcc, 0xb4, 0x81, 0x9b, 0xf1, 0xe8, 0xc1, 0x98, - 0xf0, 0x4d, 0xfc, 0x14, 0x1c, 0x49, 0xbc, 0x78, 0x32, 0x06, 0xfc, 0x10, 0x1e, 0x4d, 0xa7, 0x53, - 0x68, 0xe3, 0x86, 0x2d, 0xc6, 0x5b, 0xe7, 0x79, 0xde, 0x3f, 0xcf, 0xfb, 0xf6, 0x99, 0x01, 0x1e, - 0xa1, 0x12, 0xf3, 0xb0, 0x8f, 0x08, 0xdd, 0x12, 0x38, 0x8c, 0x39, 0x91, 0xfb, 0x5e, 0x18, 0x26, - 0x5e, 0xc8, 0xa8, 0x88, 0x87, 0x98, 0x7b, 0xc9, 0x92, 0xb7, 0x1b, 0x63, 0xbe, 0xef, 0x8e, 0x38, - 0x93, 0x0c, 0xde, 0x1c, 0x93, 0xe0, 0x86, 0x61, 0xe2, 0xe6, 0x09, 0x6e, 0xb2, 0x64, 0x35, 0x23, - 0x16, 0x31, 0x15, 0xef, 0xa5, 0x5f, 0x59, 0xaa, 0xb5, 0x10, 0x31, 0x16, 0x0d, 0xb0, 0x87, 0x46, - 0xc4, 0x43, 0x94, 0x32, 0x89, 0x24, 0x61, 0x54, 0x68, 0x76, 0xb9, 0x8a, 0x92, 0xd3, 0x26, 0x2a, - 0xc7, 0xf9, 0x34, 0x05, 0xae, 0xbf, 0xc4, 0x7b, 0x72, 0x03, 0xe3, 0x2e, 0x11, 0x92, 0x93, 0xed, - 0x38, 0x2d, 0xf9, 0x54, 0x48, 0x32, 0x44, 0x12, 0xc3, 0x5b, 0xe0, 0x52, 0x18, 0x73, 0x8e, 0xa9, - 0x7c, 0x86, 0x49, 0xd4, 0x97, 0xa6, 0xb1, 0x68, 0xb4, 0xa6, 0x83, 0x32, 0x08, 0x6d, 0x00, 0x06, - 0x48, 0xe4, 0x21, 0x53, 0x2a, 0xa4, 0x80, 0xa4, 0x3c, 0xc5, 0x7b, 0x39, 0x3f, 0x9d, 0xf1, 0x67, - 0x08, 0x5c, 0x01, 0x57, 0x76, 0x0a, 0xdd, 0xb7, 0x7a, 0x1c, 0x85, 0xe9, 0x87, 0x39, 0xb3, 0x68, - 0xb4, 0x1a, 0x41, 0xb3, 0x48, 0x6e, 0x68, 0x0e, 0x36, 0x41, 0x5d, 0x32, 0x89, 0x06, 0x66, 0x5d, - 0x05, 0x65, 0x87, 0xb4, 0x95, 0x64, 0x9b, 0x9c, 0x25, 0x64, 0x07, 0x73, 0x73, 0x56, 0x51, 0x05, - 0x24, 0xe3, 0x3b, 0x7a, 0x09, 0xe6, 0x5c, 0xce, 0xe7, 0x88, 0x73, 0x07, 0xdc, 0x7e, 0x95, 0xfe, - 0xac, 0x73, 0x96, 0x12, 0xe0, 0xdd, 0x18, 0x0b, 0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f, 0x57, - 0xbb, 0x87, 0x71, 0xbb, 0x78, 0x75, 0xe0, 0x17, 0x03, 0xcc, 0x17, 0x9c, 0x01, 0x57, 0xab, 0xeb, - 0x2b, 0x39, 0xcc, 0x7a, 0x70, 0xf1, 0x44, 0x3d, 0xc3, 0x7d, 0x35, 0xc3, 0x5d, 0xd8, 0x9a, 0x3c, - 0x43, 0xe6, 0x35, 0x78, 0x64, 0x80, 0xab, 0x25, 0x3f, 0x65, 0x86, 0xa1, 0x3d, 0x06, 0xd7, 0x2e, - 0x20, 0xe3, 0x4f, 0xa7, 0x5a, 0x8f, 0xfe, 0x36, 0x5d, 0xcf, 0xb2, 0xaa, 0x66, 0x59, 0x82, 0x5e, - 0x85, 0x59, 0x74, 0x7e, 0x9b, 0xd0, 0x1e, 0x5b, 0x7f, 0x73, 0x78, 0x6c, 0x1b, 0x47, 0xc7, 0xb6, - 0xf1, 0xe3, 0xd8, 0x36, 0x3e, 0x9f, 0xd8, 0xb5, 0xa3, 0x13, 0xbb, 0xf6, 0xed, 0xc4, 0xae, 0xbd, - 0x5d, 0x8b, 0x88, 0xec, 0xc7, 0xdb, 0x6e, 0xc8, 0x86, 0x5e, 0xc8, 0xc4, 0x90, 0x89, 0x42, 0xed, - 0xf6, 0x69, 0xed, 0x64, 0xc5, 0xdb, 0x2b, 0x37, 0x90, 0xfb, 0x23, 0x2c, 0xb6, 0x67, 0xd5, 0xab, - 0xbe, 0xf2, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xe6, 0x98, 0xdf, 0x3b, 0x95, 0x06, 0x00, 0x00, + // 670 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x41, 0x6f, 0xd3, 0x3e, + 0x14, 0xaf, 0xbb, 0x75, 0x5b, 0xbd, 0xff, 0xff, 0x62, 0x0a, 0x0a, 0x61, 0x0a, 0x53, 0x40, 0xa2, + 0x80, 0x9a, 0x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1e, 0x34, 0x27, 0x82, 0xa2, 0x11, + 0x39, 0x10, 0xf6, 0xb1, 0xcc, 0x5c, 0xaa, 0xda, 0x25, 0x67, 0x49, 0x70, 0x46, 0x76, 0x33, 0x7c, + 0x22, 0xc5, 0x8f, 0x2d, 0x68, 0x09, 0x9e, 0xdf, 0xcc, 0x65, 0x5f, 0xdf, 0x12, 0x38, 0x4c, 0x3e, + 0xac, 0xc9, 0x79, 0xd0, 0xac, 0x07, 0x8d, 0x3c, 0xb8, 0x6a, 0x30, 0xd4, 0x80, 0x35, 0xc5, 0x15, + 0xee, 0x5b, 0x35, 0xed, 0x94, 0x1e, 0x92, 0x54, 0x8a, 0xaf, 0x09, 0x1e, 0xd3, 0x4d, 0x22, 0xac, + 0x29, 0x0d, 0xe5, 0x2c, 0x29, 0xde, 0x36, 0x4d, 0xb0, 0xa6, 0x33, 0x3c, 0xb3, 0xb8, 0xd7, 0xe1, + 0xb5, 0x67, 0xc9, 0x65, 0x9d, 0xd2, 0x94, 0x80, 0xec, 0x44, 0x44, 0x2a, 0xf7, 0x35, 0x80, 0xcd, + 0xf1, 0xbe, 0x72, 0xc8, 0x99, 0x24, 0xe8, 0x39, 0x9c, 0xdc, 0xc4, 0x0a, 0xeb, 0xfe, 0xcd, 0x2e, + 0xde, 0xf7, 0x4a, 0x0c, 0x81, 0x77, 0x1a, 0xaf, 0x66, 0x73, 0x1b, 0x10, 0x69, 0x05, 0x6b, 0x58, + 0xe0, 0x81, 0xcc, 0x84, 0xbd, 0x82, 0xe7, 0x0a, 0x56, 0x23, 0xa1, 0x0b, 0xa7, 0x86, 0xda, 0x62, + 0x44, 0xdc, 0x2c, 0x25, 0x22, 0x25, 0x79, 0x30, 0xb9, 0xff, 0xed, 0x72, 0x25, 0x30, 0x04, 0xae, + 0x0d, 0xad, 0x34, 0x83, 0x69, 0x6b, 0x97, 0x6d, 0xf1, 0x2c, 0xfb, 0x67, 0x00, 0x2f, 0x9e, 0x00, + 0x1a, 0x11, 0x6b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, 0x37, 0xb5, 0x2c, 0xeb, 0x5a, 0x16, 0x90, 0x5f, + 0xa2, 0x16, 0x13, 0xdf, 0xa2, 0xc9, 0x8a, 0xbc, 0xd8, 0x3f, 0x74, 0xc0, 0xc1, 0xa1, 0x03, 0xbe, + 0x1f, 0x3a, 0xe0, 0xc3, 0x91, 0x53, 0x39, 0x38, 0x72, 0x2a, 0x5f, 0x8f, 0x9c, 0xca, 0xcb, 0x95, + 0x1e, 0x55, 0xdb, 0xd1, 0x86, 0x17, 0xf2, 0x81, 0x1f, 0x72, 0x39, 0xe0, 0x32, 0xc7, 0xdd, 0x1a, + 0x71, 0xc7, 0x4b, 0xfe, 0x6e, 0x31, 0x81, 0xda, 0x1b, 0x12, 0xb9, 0x31, 0xa5, 0xff, 0x43, 0x4b, + 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xd2, 0x95, 0x82, 0xc1, 0x47, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -834,6 +889,49 @@ func (m *QueryProviderInfoResponse) MarshalTo(dAtA []byte) (int, error) { } 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 @@ -966,6 +1064,19 @@ func (m *QueryProviderInfoRequest) Size() (n int) { } 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 } @@ -1579,6 +1690,122 @@ func (m *QueryProviderInfoResponse) Unmarshal(dAtA []byte) error { 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) From c1e8c3f44fdf3db55c3cd93d51b6c89848c3211d Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Thu, 3 Aug 2023 17:32:36 +0200 Subject: [PATCH 07/21] feat: add consumer chain-id to provider info query --- x/ccv/consumer/keeper/provider_info.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/ccv/consumer/keeper/provider_info.go b/x/ccv/consumer/keeper/provider_info.go index 67bf918bfd..a2de836935 100644 --- a/x/ccv/consumer/keeper/provider_info.go +++ b/x/ccv/consumer/keeper/provider_info.go @@ -36,7 +36,7 @@ func (k Keeper) GetProviderChainInfo(ctx sdk.Context) (*types.QueryProviderInfoR resp := types.QueryProviderInfoResponse{ Consumer: types.ChainInfo{ - ChainID: "", + ChainID: ctx.ChainID(), ClientID: consumerConnection.GetClientID(), ConnectionID: consumerConnectionID, ChannelID: consumerChannelID, From d8edc2ae03b74c1d34ee1136d436179095c67148 Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Fri, 4 Aug 2023 17:18:55 +0200 Subject: [PATCH 08/21] fix: return err when client, channel not found --- x/ccv/consumer/keeper/provider_info.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/x/ccv/consumer/keeper/provider_info.go b/x/ccv/consumer/keeper/provider_info.go index a2de836935..8ef0a401da 100644 --- a/x/ccv/consumer/keeper/provider_info.go +++ b/x/ccv/consumer/keeper/provider_info.go @@ -11,11 +11,11 @@ func (k Keeper) GetProviderChainInfo(ctx sdk.Context) (*types.QueryProviderInfoR // get the channelID for the channel to the provider. consumerChannelID, found := k.GetProviderChannel(ctx) if !found { - return nil, nil + return nil, ccvtypes.ErrChannelNotFound } consumerChannel, found := k.channelKeeper.GetChannel(ctx, ccvtypes.ConsumerPortID, consumerChannelID) if !found { - return nil, nil + return nil, ccvtypes.ErrChannelNotFound } // from channel get connection @@ -29,8 +29,7 @@ func (k Keeper) GetProviderChainInfo(ctx sdk.Context) (*types.QueryProviderInfoR consumerClientState, found := k.clientKeeper.GetClientState(ctx, consumerConnection.GetClientID()) if !found { - // todo if return err? - return nil, nil + return nil, ccvtypes.ErrClientNotFound } providerChainID := consumerClientState.(*ibctm.ClientState).ChainId From 94d9144874689e4e2af3a33ad22c6a8b9a1c7d68 Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Mon, 7 Aug 2023 16:34:07 +0200 Subject: [PATCH 09/21] fix: lint --- testutil/keeper/mocks.go | 2 +- x/ccv/consumer/client/cli/query.go | 4 +--- x/ccv/consumer/keeper/grpc_query.go | 5 ++--- x/ccv/types/expected_keepers.go | 15 ++++++--------- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/testutil/keeper/mocks.go b/testutil/keeper/mocks.go index 64dd70445c..b075819cc4 100644 --- a/testutil/keeper/mocks.go +++ b/testutil/keeper/mocks.go @@ -564,7 +564,7 @@ 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) { +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) diff --git a/x/ccv/consumer/client/cli/query.go b/x/ccv/consumer/client/cli/query.go index 4f3fbada84..164b3488d8 100644 --- a/x/ccv/consumer/client/cli/query.go +++ b/x/ccv/consumer/client/cli/query.go @@ -1,12 +1,10 @@ package cli import ( - "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" + "github.com/spf13/cobra" ) // NewQueryCmd returns a root CLI command handler for all x/ccv/provider query commands. diff --git a/x/ccv/consumer/keeper/grpc_query.go b/x/ccv/consumer/keeper/grpc_query.go index 3396709566..e90575c975 100644 --- a/x/ccv/consumer/keeper/grpc_query.go +++ b/x/ccv/consumer/keeper/grpc_query.go @@ -3,11 +3,10 @@ package keeper import ( "context" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) var _ types.QueryServer = Keeper{} diff --git a/x/ccv/types/expected_keepers.go b/x/ccv/types/expected_keepers.go index 2f203a47ea..6bca8d405e 100644 --- a/x/ccv/types/expected_keepers.go +++ b/x/ccv/types/expected_keepers.go @@ -4,22 +4,19 @@ import ( context "context" "time" - transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - conntypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" - "cosmossdk.io/math" - + abci "github.com/cometbft/cometbft/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" auth "github.com/cosmos/cosmos-sdk/x/auth/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - abci "github.com/cometbft/cometbft/abci/types" + transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + conntypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" + channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" ) // StakingKeeper defines the contract expected by provider-chain ccv module from a Staking Module that will keep track From 9ece87496a2701682c82d5c794968bb2896b3ee3 Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Mon, 7 Aug 2023 16:54:55 +0200 Subject: [PATCH 10/21] chore: fix lint --- x/ccv/consumer/client/cli/query.go | 3 ++- x/ccv/consumer/keeper/grpc_query.go | 11 ++++++----- x/ccv/consumer/keeper/provider_info.go | 2 ++ x/ccv/types/expected_keepers.go | 21 ++++++++++++--------- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/x/ccv/consumer/client/cli/query.go b/x/ccv/consumer/client/cli/query.go index 164b3488d8..d198b578a6 100644 --- a/x/ccv/consumer/client/cli/query.go +++ b/x/ccv/consumer/client/cli/query.go @@ -1,10 +1,11 @@ package cli import ( + "github.com/spf13/cobra" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" - "github.com/spf13/cobra" ) // NewQueryCmd returns a root CLI command handler for all x/ccv/provider query commands. diff --git a/x/ccv/consumer/keeper/grpc_query.go b/x/ccv/consumer/keeper/grpc_query.go index e90575c975..36559dc193 100644 --- a/x/ccv/consumer/keeper/grpc_query.go +++ b/x/ccv/consumer/keeper/grpc_query.go @@ -3,16 +3,17 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" ) var _ types.QueryServer = Keeper{} func (k Keeper) QueryNextFeeDistribution(c context.Context, - req *types.QueryNextFeeDistributionEstimateRequest, + req *types.QueryNextFeeDistributionEstimateRequest, ) (*types.QueryNextFeeDistributionEstimateResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -26,7 +27,7 @@ func (k Keeper) QueryNextFeeDistribution(c context.Context, } func (k Keeper) QueryParams(c context.Context, - req *types.QueryParamsRequest, + req *types.QueryParamsRequest, ) (*types.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -40,7 +41,7 @@ func (k Keeper) QueryParams(c context.Context, } func (k Keeper) QueryProviderChainInfo(c context.Context, - req *types.QueryProviderInfoRequest, + req *types.QueryProviderInfoRequest, ) (*types.QueryProviderInfoResponse, error) { ctx := sdk.UnwrapSDKContext(c) if req == nil { diff --git a/x/ccv/consumer/keeper/provider_info.go b/x/ccv/consumer/keeper/provider_info.go index 8ef0a401da..3660b4e69c 100644 --- a/x/ccv/consumer/keeper/provider_info.go +++ b/x/ccv/consumer/keeper/provider_info.go @@ -2,7 +2,9 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types" ) diff --git a/x/ccv/types/expected_keepers.go b/x/ccv/types/expected_keepers.go index 6bca8d405e..064b0e62eb 100644 --- a/x/ccv/types/expected_keepers.go +++ b/x/ccv/types/expected_keepers.go @@ -5,13 +5,16 @@ import ( "time" "cosmossdk.io/math" + abci "github.com/cometbft/cometbft/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" auth "github.com/cosmos/cosmos-sdk/x/auth/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" conntypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" @@ -69,13 +72,13 @@ type ChannelKeeper interface { GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) SendPacket( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, - sourcePort string, - sourceChannel string, - timeoutHeight clienttypes.Height, - timeoutTimestamp uint64, - data []byte, + ctx sdk.Context, + chanCap *capabilitytypes.Capability, + sourcePort string, + sourceChannel string, + timeoutHeight clienttypes.Height, + timeoutTimestamp uint64, + data []byte, ) (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 @@ -132,8 +135,8 @@ type IBCTransferKeeper interface { // channel type IBCCoreKeeper interface { ChannelOpenInit( - goCtx context.Context, - msg *channeltypes.MsgChannelOpenInit, + goCtx context.Context, + msg *channeltypes.MsgChannelOpenInit, ) (*channeltypes.MsgChannelOpenInitResponse, error) } From 326a88ca08380302b4868800f92b3349e59cc302 Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Mon, 7 Aug 2023 17:31:17 +0200 Subject: [PATCH 11/21] chore: lint fix --- x/ccv/consumer/client/cli/query.go | 1 + x/ccv/consumer/keeper/grpc_query.go | 11 +++++----- x/ccv/types/expected_keepers.go | 32 ++++++++++++++--------------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/x/ccv/consumer/client/cli/query.go b/x/ccv/consumer/client/cli/query.go index d198b578a6..4f3fbada84 100644 --- a/x/ccv/consumer/client/cli/query.go +++ b/x/ccv/consumer/client/cli/query.go @@ -5,6 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" ) diff --git a/x/ccv/consumer/keeper/grpc_query.go b/x/ccv/consumer/keeper/grpc_query.go index 36559dc193..e90575c975 100644 --- a/x/ccv/consumer/keeper/grpc_query.go +++ b/x/ccv/consumer/keeper/grpc_query.go @@ -3,17 +3,16 @@ package keeper import ( "context" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) var _ types.QueryServer = Keeper{} func (k Keeper) QueryNextFeeDistribution(c context.Context, - req *types.QueryNextFeeDistributionEstimateRequest, + req *types.QueryNextFeeDistributionEstimateRequest, ) (*types.QueryNextFeeDistributionEstimateResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -27,7 +26,7 @@ func (k Keeper) QueryNextFeeDistribution(c context.Context, } func (k Keeper) QueryParams(c context.Context, - req *types.QueryParamsRequest, + req *types.QueryParamsRequest, ) (*types.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -41,7 +40,7 @@ func (k Keeper) QueryParams(c context.Context, } func (k Keeper) QueryProviderChainInfo(c context.Context, - req *types.QueryProviderInfoRequest, + req *types.QueryProviderInfoRequest, ) (*types.QueryProviderInfoResponse, error) { ctx := sdk.UnwrapSDKContext(c) if req == nil { diff --git a/x/ccv/types/expected_keepers.go b/x/ccv/types/expected_keepers.go index 064b0e62eb..2f203a47ea 100644 --- a/x/ccv/types/expected_keepers.go +++ b/x/ccv/types/expected_keepers.go @@ -4,9 +4,13 @@ import ( context "context" "time" - "cosmossdk.io/math" + transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + conntypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" + channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" - abci "github.com/cometbft/cometbft/abci/types" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" auth "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -15,11 +19,7 @@ import ( slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - conntypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" + abci "github.com/cometbft/cometbft/abci/types" ) // StakingKeeper defines the contract expected by provider-chain ccv module from a Staking Module that will keep track @@ -72,13 +72,13 @@ type ChannelKeeper interface { GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) SendPacket( - ctx sdk.Context, - chanCap *capabilitytypes.Capability, - sourcePort string, - sourceChannel string, - timeoutHeight clienttypes.Height, - timeoutTimestamp uint64, - data []byte, + ctx sdk.Context, + chanCap *capabilitytypes.Capability, + sourcePort string, + sourceChannel string, + timeoutHeight clienttypes.Height, + timeoutTimestamp uint64, + data []byte, ) (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 @@ -135,8 +135,8 @@ type IBCTransferKeeper interface { // channel type IBCCoreKeeper interface { ChannelOpenInit( - goCtx context.Context, - msg *channeltypes.MsgChannelOpenInit, + goCtx context.Context, + msg *channeltypes.MsgChannelOpenInit, ) (*channeltypes.MsgChannelOpenInitResponse, error) } From 14d98c51ebd11d65f2932179fcb77f5b59b77868 Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Mon, 7 Aug 2023 17:50:29 +0200 Subject: [PATCH 12/21] chore: add nonlint --- x/ccv/consumer/keeper/grpc_query.go | 4 ++++ x/ccv/consumer/keeper/provider_info.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/x/ccv/consumer/keeper/grpc_query.go b/x/ccv/consumer/keeper/grpc_query.go index e90575c975..03089a317b 100644 --- a/x/ccv/consumer/keeper/grpc_query.go +++ b/x/ccv/consumer/keeper/grpc_query.go @@ -9,8 +9,10 @@ import ( "google.golang.org/grpc/status" ) +//nolint:typecheck var _ types.QueryServer = Keeper{} +//nolint:typecheck func (k Keeper) QueryNextFeeDistribution(c context.Context, req *types.QueryNextFeeDistributionEstimateRequest, ) (*types.QueryNextFeeDistributionEstimateResponse, error) { @@ -25,6 +27,7 @@ func (k Keeper) QueryNextFeeDistribution(c context.Context, return &types.QueryNextFeeDistributionEstimateResponse{Data: &nextDist}, nil } +//nolint:typecheck func (k Keeper) QueryParams(c context.Context, req *types.QueryParamsRequest, ) (*types.QueryParamsResponse, error) { @@ -39,6 +42,7 @@ func (k Keeper) QueryParams(c context.Context, return &types.QueryParamsResponse{Params: p}, nil } +//nolint:typecheck func (k Keeper) QueryProviderChainInfo(c context.Context, req *types.QueryProviderInfoRequest, ) (*types.QueryProviderInfoResponse, error) { diff --git a/x/ccv/consumer/keeper/provider_info.go b/x/ccv/consumer/keeper/provider_info.go index 3660b4e69c..032d4f84e3 100644 --- a/x/ccv/consumer/keeper/provider_info.go +++ b/x/ccv/consumer/keeper/provider_info.go @@ -3,12 +3,14 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + //nolint:typecheck ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types" ) +//nolint:typecheck func (k Keeper) GetProviderChainInfo(ctx sdk.Context) (*types.QueryProviderInfoResponse, error) { // get the channelID for the channel to the provider. consumerChannelID, found := k.GetProviderChannel(ctx) From 1354837199f11658384fc797ecef1dd698689d85 Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Mon, 7 Aug 2023 18:01:56 +0200 Subject: [PATCH 13/21] chore: add nonlint to the right place --- x/ccv/consumer/keeper/grpc_query.go | 12 ++++-------- x/ccv/consumer/keeper/provider_info.go | 6 ++---- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/x/ccv/consumer/keeper/grpc_query.go b/x/ccv/consumer/keeper/grpc_query.go index 03089a317b..0ea3dd9645 100644 --- a/x/ccv/consumer/keeper/grpc_query.go +++ b/x/ccv/consumer/keeper/grpc_query.go @@ -9,11 +9,9 @@ import ( "google.golang.org/grpc/status" ) -//nolint:typecheck -var _ types.QueryServer = Keeper{} +var _ types.QueryServer = Keeper{} //nolint:typecheck -//nolint:typecheck -func (k Keeper) QueryNextFeeDistribution(c context.Context, +func (k Keeper) QueryNextFeeDistribution(c context.Context, //nolint:typecheck req *types.QueryNextFeeDistributionEstimateRequest, ) (*types.QueryNextFeeDistributionEstimateResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -27,8 +25,7 @@ func (k Keeper) QueryNextFeeDistribution(c context.Context, return &types.QueryNextFeeDistributionEstimateResponse{Data: &nextDist}, nil } -//nolint:typecheck -func (k Keeper) QueryParams(c context.Context, +func (k Keeper) QueryParams(c context.Context, //nolint:typecheck req *types.QueryParamsRequest, ) (*types.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -42,8 +39,7 @@ func (k Keeper) QueryParams(c context.Context, return &types.QueryParamsResponse{Params: p}, nil } -//nolint:typecheck -func (k Keeper) QueryProviderChainInfo(c context.Context, +func (k Keeper) QueryProviderChainInfo(c context.Context, //nolint:typecheck req *types.QueryProviderInfoRequest, ) (*types.QueryProviderInfoResponse, error) { ctx := sdk.UnwrapSDKContext(c) diff --git a/x/ccv/consumer/keeper/provider_info.go b/x/ccv/consumer/keeper/provider_info.go index 032d4f84e3..436ea4b95b 100644 --- a/x/ccv/consumer/keeper/provider_info.go +++ b/x/ccv/consumer/keeper/provider_info.go @@ -3,15 +3,13 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - //nolint:typecheck - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" //nolint:typecheck "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types" ) -//nolint:typecheck -func (k Keeper) GetProviderChainInfo(ctx sdk.Context) (*types.QueryProviderInfoResponse, error) { +func (k Keeper) GetProviderChainInfo(ctx sdk.Context) (*types.QueryProviderInfoResponse, error) { //nolint:typecheck // get the channelID for the channel to the provider. consumerChannelID, found := k.GetProviderChannel(ctx) if !found { From d739877878736b39b390c73c4ea54d0de311c51c Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Mon, 7 Aug 2023 18:17:50 +0200 Subject: [PATCH 14/21] chore: add nolint nolintlint --- x/ccv/consumer/keeper/grpc_query.go | 8 ++++---- x/ccv/consumer/keeper/provider_info.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/x/ccv/consumer/keeper/grpc_query.go b/x/ccv/consumer/keeper/grpc_query.go index 0ea3dd9645..22d19bc0e8 100644 --- a/x/ccv/consumer/keeper/grpc_query.go +++ b/x/ccv/consumer/keeper/grpc_query.go @@ -9,9 +9,9 @@ import ( "google.golang.org/grpc/status" ) -var _ types.QueryServer = Keeper{} //nolint:typecheck +var _ types.QueryServer = Keeper{} //nolint:typecheck,nolintlint -func (k Keeper) QueryNextFeeDistribution(c context.Context, //nolint:typecheck +func (k Keeper) QueryNextFeeDistribution(c context.Context, //nolint:typecheck,nolintlint req *types.QueryNextFeeDistributionEstimateRequest, ) (*types.QueryNextFeeDistributionEstimateResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -25,7 +25,7 @@ func (k Keeper) QueryNextFeeDistribution(c context.Context, //nolint:typecheck return &types.QueryNextFeeDistributionEstimateResponse{Data: &nextDist}, nil } -func (k Keeper) QueryParams(c context.Context, //nolint:typecheck +func (k Keeper) QueryParams(c context.Context, //nolint:typecheck,nolintlint req *types.QueryParamsRequest, ) (*types.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -39,7 +39,7 @@ func (k Keeper) QueryParams(c context.Context, //nolint:typecheck return &types.QueryParamsResponse{Params: p}, nil } -func (k Keeper) QueryProviderChainInfo(c context.Context, //nolint:typecheck +func (k Keeper) QueryProviderChainInfo(c context.Context, //nolint:typecheck,nolintlint req *types.QueryProviderInfoRequest, ) (*types.QueryProviderInfoResponse, error) { ctx := sdk.UnwrapSDKContext(c) diff --git a/x/ccv/consumer/keeper/provider_info.go b/x/ccv/consumer/keeper/provider_info.go index 436ea4b95b..3b163a1bfa 100644 --- a/x/ccv/consumer/keeper/provider_info.go +++ b/x/ccv/consumer/keeper/provider_info.go @@ -3,13 +3,13 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" //nolint:typecheck + ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" //nolint:typecheck,nolintlint "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types" ) -func (k Keeper) GetProviderChainInfo(ctx sdk.Context) (*types.QueryProviderInfoResponse, error) { //nolint:typecheck +func (k Keeper) GetProviderChainInfo(ctx sdk.Context) (*types.QueryProviderInfoResponse, error) { //nolint:typecheck,nolintlint // get the channelID for the channel to the provider. consumerChannelID, found := k.GetProviderChannel(ctx) if !found { From ed67f9f70f0426600396a2308072f745a3783534 Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Mon, 7 Aug 2023 18:22:05 +0200 Subject: [PATCH 15/21] chore: nolint all --- x/ccv/consumer/keeper/grpc_query.go | 8 ++++---- x/ccv/consumer/keeper/provider_info.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/x/ccv/consumer/keeper/grpc_query.go b/x/ccv/consumer/keeper/grpc_query.go index 22d19bc0e8..f98b730ebd 100644 --- a/x/ccv/consumer/keeper/grpc_query.go +++ b/x/ccv/consumer/keeper/grpc_query.go @@ -9,9 +9,9 @@ import ( "google.golang.org/grpc/status" ) -var _ types.QueryServer = Keeper{} //nolint:typecheck,nolintlint +var _ types.QueryServer = Keeper{} //nolint -func (k Keeper) QueryNextFeeDistribution(c context.Context, //nolint:typecheck,nolintlint +func (k Keeper) QueryNextFeeDistribution(c context.Context, //nolint req *types.QueryNextFeeDistributionEstimateRequest, ) (*types.QueryNextFeeDistributionEstimateResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -25,7 +25,7 @@ func (k Keeper) QueryNextFeeDistribution(c context.Context, //nolint:typecheck,n return &types.QueryNextFeeDistributionEstimateResponse{Data: &nextDist}, nil } -func (k Keeper) QueryParams(c context.Context, //nolint:typecheck,nolintlint +func (k Keeper) QueryParams(c context.Context, //nolint req *types.QueryParamsRequest, ) (*types.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -39,7 +39,7 @@ func (k Keeper) QueryParams(c context.Context, //nolint:typecheck,nolintlint return &types.QueryParamsResponse{Params: p}, nil } -func (k Keeper) QueryProviderChainInfo(c context.Context, //nolint:typecheck,nolintlint +func (k Keeper) QueryProviderChainInfo(c context.Context, //nolint req *types.QueryProviderInfoRequest, ) (*types.QueryProviderInfoResponse, error) { ctx := sdk.UnwrapSDKContext(c) diff --git a/x/ccv/consumer/keeper/provider_info.go b/x/ccv/consumer/keeper/provider_info.go index 3b163a1bfa..e5ee257614 100644 --- a/x/ccv/consumer/keeper/provider_info.go +++ b/x/ccv/consumer/keeper/provider_info.go @@ -3,13 +3,13 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" //nolint:typecheck,nolintlint + ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" //nolint "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types" ) -func (k Keeper) GetProviderChainInfo(ctx sdk.Context) (*types.QueryProviderInfoResponse, error) { //nolint:typecheck,nolintlint +func (k Keeper) GetProviderChainInfo(ctx sdk.Context) (*types.QueryProviderInfoResponse, error) { //nolint // get the channelID for the channel to the provider. consumerChannelID, found := k.GetProviderChannel(ctx) if !found { From a4bd742b59dc776c2bdf727a32e5b3e4b577d3cb Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Mon, 7 Aug 2023 18:33:06 +0200 Subject: [PATCH 16/21] chore: nolint:golint --- x/ccv/consumer/keeper/grpc_query.go | 8 ++++---- x/ccv/consumer/keeper/provider_info.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/x/ccv/consumer/keeper/grpc_query.go b/x/ccv/consumer/keeper/grpc_query.go index f98b730ebd..5cd5cb1092 100644 --- a/x/ccv/consumer/keeper/grpc_query.go +++ b/x/ccv/consumer/keeper/grpc_query.go @@ -9,9 +9,9 @@ import ( "google.golang.org/grpc/status" ) -var _ types.QueryServer = Keeper{} //nolint +var _ types.QueryServer = Keeper{} //nolint:golint -func (k Keeper) QueryNextFeeDistribution(c context.Context, //nolint +func (k Keeper) QueryNextFeeDistribution(c context.Context, //nolint:golint req *types.QueryNextFeeDistributionEstimateRequest, ) (*types.QueryNextFeeDistributionEstimateResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -25,7 +25,7 @@ func (k Keeper) QueryNextFeeDistribution(c context.Context, //nolint return &types.QueryNextFeeDistributionEstimateResponse{Data: &nextDist}, nil } -func (k Keeper) QueryParams(c context.Context, //nolint +func (k Keeper) QueryParams(c context.Context, //nolint:golint req *types.QueryParamsRequest, ) (*types.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -39,7 +39,7 @@ func (k Keeper) QueryParams(c context.Context, //nolint return &types.QueryParamsResponse{Params: p}, nil } -func (k Keeper) QueryProviderChainInfo(c context.Context, //nolint +func (k Keeper) QueryProviderChainInfo(c context.Context, //nolint:golint req *types.QueryProviderInfoRequest, ) (*types.QueryProviderInfoResponse, error) { ctx := sdk.UnwrapSDKContext(c) diff --git a/x/ccv/consumer/keeper/provider_info.go b/x/ccv/consumer/keeper/provider_info.go index e5ee257614..898fbdb677 100644 --- a/x/ccv/consumer/keeper/provider_info.go +++ b/x/ccv/consumer/keeper/provider_info.go @@ -3,13 +3,13 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" //nolint + ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" //nolint:golint "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types" ) -func (k Keeper) GetProviderChainInfo(ctx sdk.Context) (*types.QueryProviderInfoResponse, error) { //nolint +func (k Keeper) GetProviderChainInfo(ctx sdk.Context) (*types.QueryProviderInfoResponse, error) { //nolint:golint // get the channelID for the channel to the provider. consumerChannelID, found := k.GetProviderChannel(ctx) if !found { From 4b6fdbe90dba75639717f68d3d51348066e96b50 Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Mon, 7 Aug 2023 18:42:59 +0200 Subject: [PATCH 17/21] chore: fix package import order --- x/ccv/consumer/keeper/grpc_query.go | 6 ++++-- x/ccv/consumer/keeper/provider_info.go | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/x/ccv/consumer/keeper/grpc_query.go b/x/ccv/consumer/keeper/grpc_query.go index 5cd5cb1092..f17ea7bd34 100644 --- a/x/ccv/consumer/keeper/grpc_query.go +++ b/x/ccv/consumer/keeper/grpc_query.go @@ -3,10 +3,12 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" ) var _ types.QueryServer = Keeper{} //nolint:golint diff --git a/x/ccv/consumer/keeper/provider_info.go b/x/ccv/consumer/keeper/provider_info.go index 898fbdb677..65c661a528 100644 --- a/x/ccv/consumer/keeper/provider_info.go +++ b/x/ccv/consumer/keeper/provider_info.go @@ -1,10 +1,10 @@ package keeper import ( - sdk "github.com/cosmos/cosmos-sdk/types" - 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" ) From 02b03389f99adebe396f9c638d600fd673f78ebb Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Tue, 8 Aug 2023 12:59:18 +0200 Subject: [PATCH 18/21] chore: update queryProviderChainInfo to queryProviderInfo --- .../ccv/consumer/v1/query.proto | 2 +- x/ccv/consumer/keeper/grpc_query.go | 8 +- x/ccv/consumer/types/query.pb.go | 110 +++++++++--------- x/ccv/consumer/types/query.pb.gw.go | 24 ++-- 4 files changed, 72 insertions(+), 72 deletions(-) diff --git a/proto/interchain_security/ccv/consumer/v1/query.proto b/proto/interchain_security/ccv/consumer/v1/query.proto index 0c4f5e3ef9..de99dcf4e6 100644 --- a/proto/interchain_security/ccv/consumer/v1/query.proto +++ b/proto/interchain_security/ccv/consumer/v1/query.proto @@ -20,7 +20,7 @@ service Query { option (google.api.http).get = "/interchain_security/ccv/consumer/params"; } - rpc QueryProviderChainInfo(QueryProviderInfoRequest) returns (QueryProviderInfoResponse) { + rpc QueryProviderInfo(QueryProviderInfoRequest) returns (QueryProviderInfoResponse) { option (google.api.http).get = "/interchain_security/ccv/consumer/provider-info"; } } diff --git a/x/ccv/consumer/keeper/grpc_query.go b/x/ccv/consumer/keeper/grpc_query.go index f17ea7bd34..04e149a0d6 100644 --- a/x/ccv/consumer/keeper/grpc_query.go +++ b/x/ccv/consumer/keeper/grpc_query.go @@ -14,7 +14,7 @@ import ( var _ types.QueryServer = Keeper{} //nolint:golint func (k Keeper) QueryNextFeeDistribution(c context.Context, //nolint:golint - req *types.QueryNextFeeDistributionEstimateRequest, + req *types.QueryNextFeeDistributionEstimateRequest, ) (*types.QueryNextFeeDistributionEstimateResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -28,7 +28,7 @@ func (k Keeper) QueryNextFeeDistribution(c context.Context, //nolint:golint } func (k Keeper) QueryParams(c context.Context, //nolint:golint - req *types.QueryParamsRequest, + req *types.QueryParamsRequest, ) (*types.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -41,8 +41,8 @@ func (k Keeper) QueryParams(c context.Context, //nolint:golint return &types.QueryParamsResponse{Params: p}, nil } -func (k Keeper) QueryProviderChainInfo(c context.Context, //nolint:golint - req *types.QueryProviderInfoRequest, +func (k Keeper) QueryProviderInfo(c context.Context, //nolint:golint + req *types.QueryProviderInfoRequest, ) (*types.QueryProviderInfoResponse, error) { ctx := sdk.UnwrapSDKContext(c) if req == nil { diff --git a/x/ccv/consumer/types/query.pb.go b/x/ccv/consumer/types/query.pb.go index 36fd41f936..a0d094460b 100644 --- a/x/ccv/consumer/types/query.pb.go +++ b/x/ccv/consumer/types/query.pb.go @@ -467,49 +467,49 @@ func init() { } var fileDescriptor_f627751d3cc10225 = []byte{ - // 670 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x41, 0x6f, 0xd3, 0x3e, - 0x14, 0xaf, 0xbb, 0x75, 0x5b, 0xbd, 0xff, 0xff, 0x62, 0x0a, 0x0a, 0x61, 0x0a, 0x53, 0x40, 0xa2, - 0x80, 0x9a, 0xb0, 0xed, 0x30, 0x38, 0x0c, 0x10, 0x2d, 0x13, 0x95, 0x00, 0x8d, 0x08, 0x09, 0x89, - 0xcb, 0xf0, 0x32, 0xaf, 0xb3, 0xd4, 0xda, 0x9d, 0xed, 0x44, 0xdb, 0x0d, 0xc1, 0x8d, 0x03, 0x42, - 0xe2, 0x9b, 0xf0, 0x05, 0xb8, 0xee, 0x38, 0x89, 0x0b, 0x27, 0x84, 0x36, 0x3e, 0x04, 0x47, 0x14, - 0xc7, 0xe9, 0x12, 0x31, 0xad, 0x19, 0x70, 0x8b, 0xdf, 0xef, 0xbd, 0xdf, 0xfb, 0xbd, 0xe7, 0xf7, - 0x1c, 0xe8, 0x53, 0xa6, 0x88, 0x08, 0xb7, 0x31, 0x65, 0xeb, 0x92, 0x84, 0x91, 0xa0, 0x6a, 0xcf, - 0x0f, 0xc3, 0xd8, 0x0f, 0x39, 0x93, 0xd1, 0x80, 0x08, 0x3f, 0x5e, 0xf0, 0x77, 0x22, 0x22, 0xf6, - 0xbc, 0xa1, 0xe0, 0x8a, 0xa3, 0x2b, 0x27, 0x04, 0x78, 0x61, 0x18, 0x7b, 0x59, 0x80, 0x17, 0x2f, - 0xd8, 0x8d, 0x1e, 0xef, 0x71, 0xed, 0xef, 0x27, 0x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xf8, 0x58, 0xbd, 0x83, 0x96, 0xc7, 0xbf, 0x92, 0xc9, - 0x73, 0xd0, 0xda, 0x22, 0xa4, 0x95, 0x5f, 0x76, 0xf4, 0x09, 0xc0, 0xd9, 0xdc, 0x2c, 0xa3, 0xe5, - 0xf2, 0xfa, 0x0a, 0x3b, 0x61, 0xdf, 0x3e, 0x7b, 0xa0, 0xa9, 0xe1, 0x96, 0xae, 0xe1, 0x06, 0x6a, - 0x8e, 0xaf, 0x21, 0xdd, 0x0e, 0x74, 0x00, 0xe0, 0x85, 0xc2, 0x06, 0x1c, 0x0f, 0xd3, 0xca, 0x19, - 0x64, 0xfc, 0xbe, 0x5b, 0xf6, 0xdd, 0x3f, 0x0d, 0x37, 0xb5, 0x2c, 0xeb, 0x5a, 0x16, 0x90, 0x5f, - 0xa2, 0x16, 0x13, 0xdf, 0xa2, 0xc9, 0x8a, 0xbc, 0xd8, 0x3f, 0x74, 0xc0, 0xc1, 0xa1, 0x03, 0xbe, - 0x1f, 0x3a, 0xe0, 0xc3, 0x91, 0x53, 0x39, 0x38, 0x72, 0x2a, 0x5f, 0x8f, 0x9c, 0xca, 0xcb, 0x95, - 0x1e, 0x55, 0xdb, 0xd1, 0x86, 0x17, 0xf2, 0x81, 0x1f, 0x72, 0x39, 0xe0, 0x32, 0xc7, 0xdd, 0x1a, - 0x71, 0xc7, 0x4b, 0xfe, 0x6e, 0x31, 0x81, 0xda, 0x1b, 0x12, 0xb9, 0x31, 0xa5, 0xff, 0x43, 0x4b, - 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xd2, 0x95, 0x82, 0xc1, 0x47, 0x07, 0x00, 0x00, + // 669 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x41, 0x6b, 0xd4, 0x4e, + 0x14, 0xdf, 0xd9, 0x76, 0xdb, 0xee, 0xf4, 0xff, 0x3f, 0x38, 0xae, 0x10, 0x63, 0x89, 0x25, 0x0a, + 0xae, 0xca, 0x26, 0xb6, 0x3d, 0x54, 0x0f, 0x55, 0x71, 0xd7, 0xe2, 0x82, 0x4a, 0x0d, 0x82, 0xe0, + 0xa5, 0x4e, 0xd3, 0xe9, 0x76, 0x60, 0x77, 0x26, 0x9d, 0x99, 0x84, 0xf6, 0x26, 0x8a, 0x57, 0x11, + 0xfc, 0x26, 0x7e, 0x01, 0xaf, 0x05, 0x2f, 0x05, 0x2f, 0x9e, 0x44, 0x5a, 0x3f, 0x84, 0x47, 0xc9, + 0x64, 0xb2, 0xcd, 0xd2, 0xd2, 0xa6, 0xea, 0x2d, 0xf3, 0x7e, 0xef, 0xfd, 0xde, 0xef, 0xbd, 0x79, + 0x6f, 0x02, 0x7d, 0xca, 0x14, 0x11, 0xe1, 0x26, 0xa6, 0x6c, 0x55, 0x92, 0x30, 0x16, 0x54, 0xed, + 0xf8, 0x61, 0x98, 0xf8, 0x21, 0x67, 0x32, 0x1e, 0x10, 0xe1, 0x27, 0x73, 0xfe, 0x56, 0x4c, 0xc4, + 0x8e, 0x17, 0x09, 0xae, 0x38, 0xba, 0x72, 0x4c, 0x80, 0x17, 0x86, 0x89, 0x97, 0x07, 0x78, 0xc9, + 0x9c, 0xdd, 0xe8, 0xf1, 0x1e, 0xd7, 0xfe, 0x7e, 0xfa, 0x95, 0x85, 0xda, 0x33, 0x3d, 0xce, 0x7b, + 0x7d, 0xe2, 0xe3, 0x88, 0xfa, 0x98, 0x31, 0xae, 0xb0, 0xa2, 0x9c, 0x49, 0x83, 0xce, 0x97, 0x51, + 0x32, 0x4c, 0xa2, 0x63, 0xdc, 0xf7, 0x55, 0x78, 0xe9, 0x29, 0xd9, 0x56, 0xcb, 0x84, 0x74, 0xa8, + 0x54, 0x82, 0xae, 0xc5, 0x29, 0xe5, 0x43, 0xa9, 0xe8, 0x00, 0x2b, 0x82, 0xae, 0xc2, 0xff, 0xc3, + 0x58, 0x08, 0xc2, 0xd4, 0x23,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, 0xa0, + 0xe0, 0xe8, 0x5a, 0xd9, 0x77, 0xff, 0x34, 0xdc, 0x94, 0xb1, 0xa8, 0xcb, 0x98, 0x43, 0x7e, 0x89, + 0x32, 0x4c, 0x7c, 0x8b, 0xa6, 0xdb, 0xf1, 0x62, 0x77, 0xdf, 0x01, 0x7b, 0xfb, 0x0e, 0xf8, 0xb1, + 0xef, 0x80, 0x0f, 0x07, 0x4e, 0x65, 0xef, 0xc0, 0xa9, 0x7c, 0x3b, 0x70, 0x2a, 0x2f, 0x97, 0x7a, + 0x54, 0x6d, 0xc6, 0x6b, 0x5e, 0xc8, 0x07, 0x7e, 0xc8, 0xe5, 0x80, 0xcb, 0x02, 0x77, 0x6b, 0xc8, + 0x9d, 0x2c, 0xf8, 0xdb, 0xa3, 0x09, 0xd4, 0x4e, 0x44, 0xe4, 0xda, 0x84, 0xfe, 0x05, 0x2d, 0xfc, + 0x0e, 0x00, 0x00, 0xff, 0xff, 0x58, 0xae, 0xfe, 0x41, 0x42, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -529,7 +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) - QueryProviderChainInfo(ctx context.Context, in *QueryProviderInfoRequest, opts ...grpc.CallOption) (*QueryProviderInfoResponse, error) + QueryProviderInfo(ctx context.Context, in *QueryProviderInfoRequest, opts ...grpc.CallOption) (*QueryProviderInfoResponse, error) } type queryClient struct { @@ -558,9 +558,9 @@ func (c *queryClient) QueryParams(ctx context.Context, in *QueryParamsRequest, o return out, nil } -func (c *queryClient) QueryProviderChainInfo(ctx context.Context, in *QueryProviderInfoRequest, opts ...grpc.CallOption) (*QueryProviderInfoResponse, error) { +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/QueryProviderChainInfo", in, out, opts...) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.consumer.v1.Query/QueryProviderInfo", in, out, opts...) if err != nil { return nil, err } @@ -574,7 +574,7 @@ type QueryServer interface { QueryNextFeeDistribution(context.Context, *QueryNextFeeDistributionEstimateRequest) (*QueryNextFeeDistributionEstimateResponse, error) // QueryParams queries the ccv/consumer module parameters. QueryParams(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - QueryProviderChainInfo(context.Context, *QueryProviderInfoRequest) (*QueryProviderInfoResponse, error) + QueryProviderInfo(context.Context, *QueryProviderInfoRequest) (*QueryProviderInfoResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -587,8 +587,8 @@ 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) QueryProviderChainInfo(ctx context.Context, req *QueryProviderInfoRequest) (*QueryProviderInfoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryProviderChainInfo 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) { @@ -631,20 +631,20 @@ func _Query_QueryParams_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } -func _Query_QueryProviderChainInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +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).QueryProviderChainInfo(ctx, in) + return srv.(QueryServer).QueryProviderInfo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/interchain_security.ccv.consumer.v1.Query/QueryProviderChainInfo", + FullMethod: "/interchain_security.ccv.consumer.v1.Query/QueryProviderInfo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryProviderChainInfo(ctx, req.(*QueryProviderInfoRequest)) + return srv.(QueryServer).QueryProviderInfo(ctx, req.(*QueryProviderInfoRequest)) } return interceptor(ctx, in, info, handler) } @@ -662,8 +662,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_QueryParams_Handler, }, { - MethodName: "QueryProviderChainInfo", - Handler: _Query_QueryProviderChainInfo_Handler, + MethodName: "QueryProviderInfo", + Handler: _Query_QueryProviderInfo_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/x/ccv/consumer/types/query.pb.gw.go b/x/ccv/consumer/types/query.pb.gw.go index 791849b2c8..1151ab0b60 100644 --- a/x/ccv/consumer/types/query.pb.gw.go +++ b/x/ccv/consumer/types/query.pb.gw.go @@ -69,20 +69,20 @@ func local_request_Query_QueryParams_0(ctx context.Context, marshaler runtime.Ma } -func request_Query_QueryProviderChainInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +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.QueryProviderChainInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.QueryProviderInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_QueryProviderChainInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +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.QueryProviderChainInfo(ctx, &protoReq) + msg, err := server.QueryProviderInfo(ctx, &protoReq) return msg, metadata, err } @@ -139,7 +139,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_QueryProviderChainInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + 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 @@ -150,7 +150,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QueryProviderChainInfo_0(rctx, inboundMarshaler, server, req, pathParams) + 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 { @@ -158,7 +158,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QueryProviderChainInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryProviderInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -243,7 +243,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_QueryProviderChainInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + 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) @@ -252,14 +252,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_QueryProviderChainInfo_0(rctx, inboundMarshaler, client, req, pathParams) + 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_QueryProviderChainInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_QueryProviderInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -271,7 +271,7 @@ var ( 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_QueryProviderChainInfo_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))) + 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 ( @@ -279,5 +279,5 @@ var ( forward_Query_QueryParams_0 = runtime.ForwardResponseMessage - forward_Query_QueryProviderChainInfo_0 = runtime.ForwardResponseMessage + forward_Query_QueryProviderInfo_0 = runtime.ForwardResponseMessage ) From 8a904ee5f79fb763b1d1a77388c36cec4fbb3311 Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Tue, 8 Aug 2023 13:39:20 +0200 Subject: [PATCH 19/21] chore: update proto --- .../ccv/consumer/v1/query.proto | 8 +- x/ccv/consumer/keeper/grpc_query.go | 8 +- x/ccv/consumer/keeper/provider_info.go | 3 +- x/ccv/consumer/types/query.pb.go | 94 +++++++++---------- 4 files changed, 56 insertions(+), 57 deletions(-) diff --git a/proto/interchain_security/ccv/consumer/v1/query.proto b/proto/interchain_security/ccv/consumer/v1/query.proto index de99dcf4e6..43a7b0bccc 100644 --- a/proto/interchain_security/ccv/consumer/v1/query.proto +++ b/proto/interchain_security/ccv/consumer/v1/query.proto @@ -65,8 +65,8 @@ message QueryProviderInfoResponse { } message ChainInfo { - string ChainID = 1; - string ClientID = 2; - string ConnectionID = 3; - string ChannelID = 4; + string chainID = 1; + string clientID = 2; + string connectionID = 3; + string channelID = 4; } diff --git a/x/ccv/consumer/keeper/grpc_query.go b/x/ccv/consumer/keeper/grpc_query.go index 04e149a0d6..80e6b695a9 100644 --- a/x/ccv/consumer/keeper/grpc_query.go +++ b/x/ccv/consumer/keeper/grpc_query.go @@ -14,7 +14,7 @@ import ( var _ types.QueryServer = Keeper{} //nolint:golint func (k Keeper) QueryNextFeeDistribution(c context.Context, //nolint:golint - req *types.QueryNextFeeDistributionEstimateRequest, + req *types.QueryNextFeeDistributionEstimateRequest, ) (*types.QueryNextFeeDistributionEstimateResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -28,7 +28,7 @@ func (k Keeper) QueryNextFeeDistribution(c context.Context, //nolint:golint } func (k Keeper) QueryParams(c context.Context, //nolint:golint - req *types.QueryParamsRequest, + req *types.QueryParamsRequest, ) (*types.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) @@ -42,12 +42,12 @@ func (k Keeper) QueryParams(c context.Context, //nolint:golint } func (k Keeper) QueryProviderInfo(c context.Context, //nolint:golint - req *types.QueryProviderInfoRequest, + req *types.QueryProviderInfoRequest, ) (*types.QueryProviderInfoResponse, error) { ctx := sdk.UnwrapSDKContext(c) if req == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } - return k.GetProviderChainInfo(ctx) + return k.GetProviderInfo(ctx) } diff --git a/x/ccv/consumer/keeper/provider_info.go b/x/ccv/consumer/keeper/provider_info.go index 65c661a528..d8dfef100a 100644 --- a/x/ccv/consumer/keeper/provider_info.go +++ b/x/ccv/consumer/keeper/provider_info.go @@ -9,8 +9,7 @@ import ( ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types" ) -func (k Keeper) GetProviderChainInfo(ctx sdk.Context) (*types.QueryProviderInfoResponse, error) { //nolint:golint - // get the channelID for the channel to the provider. +func (k Keeper) GetProviderInfo(ctx sdk.Context) (*types.QueryProviderInfoResponse, error) { //nolint:golint consumerChannelID, found := k.GetProviderChannel(ctx) if !found { return nil, ccvtypes.ErrChannelNotFound diff --git a/x/ccv/consumer/types/query.pb.go b/x/ccv/consumer/types/query.pb.go index a0d094460b..effe4757ef 100644 --- a/x/ccv/consumer/types/query.pb.go +++ b/x/ccv/consumer/types/query.pb.go @@ -384,10 +384,10 @@ func (m *QueryProviderInfoResponse) GetProvider() 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"` + 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{} } @@ -467,49 +467,49 @@ func init() { } var fileDescriptor_f627751d3cc10225 = []byte{ - // 669 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x41, 0x6b, 0xd4, 0x4e, - 0x14, 0xdf, 0xd9, 0x76, 0xdb, 0xee, 0xf4, 0xff, 0x3f, 0x38, 0xae, 0x10, 0x63, 0x89, 0x25, 0x0a, - 0xae, 0xca, 0x26, 0xb6, 0x3d, 0x54, 0x0f, 0x55, 0x71, 0xd7, 0xe2, 0x82, 0x4a, 0x0d, 0x82, 0xe0, - 0xa5, 0x4e, 0xd3, 0xe9, 0x76, 0x60, 0x77, 0x26, 0x9d, 0x99, 0x84, 0xf6, 0x26, 0x8a, 0x57, 0x11, - 0xfc, 0x26, 0x7e, 0x01, 0xaf, 0x05, 0x2f, 0x05, 0x2f, 0x9e, 0x44, 0x5a, 0x3f, 0x84, 0x47, 0xc9, - 0x64, 0xb2, 0xcd, 0xd2, 0xd2, 0xa6, 0xea, 0x2d, 0xf3, 0x7e, 0xef, 0xfd, 0xde, 0xef, 0xbd, 0x79, - 0x6f, 0x02, 0x7d, 0xca, 0x14, 0x11, 0xe1, 0x26, 0xa6, 0x6c, 0x55, 0x92, 0x30, 0x16, 0x54, 0xed, - 0xf8, 0x61, 0x98, 0xf8, 0x21, 0x67, 0x32, 0x1e, 0x10, 0xe1, 0x27, 0x73, 0xfe, 0x56, 0x4c, 0xc4, - 0x8e, 0x17, 0x09, 0xae, 0x38, 0xba, 0x72, 0x4c, 0x80, 0x17, 0x86, 0x89, 0x97, 0x07, 0x78, 0xc9, - 0x9c, 0xdd, 0xe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 0x62, - 0xcb, 0x6e, 0xdb, 0xbd, 0xf7, 0xe6, 0xeb, 0xcf, 0x8f, 0xd5, 0x3b, 0x68, 0xf1, 0xf4, 0x57, 0x32, - 0x7d, 0x0e, 0x5a, 0x1b, 0x84, 0xb4, 0x8a, 0xcb, 0x8e, 0x3e, 0x01, 0x38, 0x5d, 0x98, 0x65, 0xb4, - 0x58, 0x5e, 0xdf, 0xc8, 0x4e, 0xd8, 0xb7, 0xcf, 0x1e, 0x68, 0x6a, 0xb8, 0xa5, 0x6b, 0xb8, 0x81, - 0x9a, 0xa7, 0xd7, 0x90, 0x6d, 0x07, 0xfa, 0x02, 0xe0, 0xb9, 0x23, 0x1b, 0x80, 0x96, 0xce, 0xa0, - 0xe0, 0xe8, 0x5a, 0xd9, 0x77, 0xff, 0x34, 0xdc, 0x94, 0xb1, 0xa8, 0xcb, 0x98, 0x43, 0x7e, 0x89, - 0x32, 0x4c, 0x7c, 0x8b, 0xa6, 0xdb, 0xf1, 0x62, 0x77, 0xdf, 0x01, 0x7b, 0xfb, 0x0e, 0xf8, 0xb1, - 0xef, 0x80, 0x0f, 0x07, 0x4e, 0x65, 0xef, 0xc0, 0xa9, 0x7c, 0x3b, 0x70, 0x2a, 0x2f, 0x97, 0x7a, - 0x54, 0x6d, 0xc6, 0x6b, 0x5e, 0xc8, 0x07, 0x7e, 0xc8, 0xe5, 0x80, 0xcb, 0x02, 0x77, 0x6b, 0xc8, - 0x9d, 0x2c, 0xf8, 0xdb, 0xa3, 0x09, 0xd4, 0x4e, 0x44, 0xe4, 0xda, 0x84, 0xfe, 0x05, 0x2d, 0xfc, - 0x0e, 0x00, 0x00, 0xff, 0xff, 0x58, 0xae, 0xfe, 0x41, 0x42, 0x07, 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, 0xa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e, 0x43, 0xba, 0x1d, 0xe8, 0x8b, 0x05, 0xe7, 0x8e, 0x6c, 0x00, 0x5a, + 0x3a, 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. From 856ce9e979d5e8656d6b289f06c8f64976ffb292 Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Tue, 8 Aug 2023 13:44:04 +0200 Subject: [PATCH 20/21] update query.go --- x/ccv/consumer/client/cli/query.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/ccv/consumer/client/cli/query.go b/x/ccv/consumer/client/cli/query.go index 4f3fbada84..dc1ecfc2f4 100644 --- a/x/ccv/consumer/client/cli/query.go +++ b/x/ccv/consumer/client/cli/query.go @@ -67,7 +67,7 @@ func CmdProviderInfo() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) req := &types.QueryProviderInfoRequest{} - res, err := queryClient.QueryProviderChainInfo(cmd.Context(), req) + res, err := queryClient.QueryProviderInfo(cmd.Context(), req) if err != nil { return err } From 8971455799f59eaf6463145142816c3f02cc6f1c Mon Sep 17 00:00:00 2001 From: Yaru Wang Date: Wed, 9 Aug 2023 10:10:40 +0200 Subject: [PATCH 21/21] docs: update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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