From e8227744ecc485ebfbab9bf2148f21c8b644ec46 Mon Sep 17 00:00:00 2001 From: sahith-narahari Date: Sat, 27 Jun 2020 20:45:45 +0530 Subject: [PATCH 1/8] Add grpc methods - slashing --- proto/cosmos/slashing/query.proto | 52 + proto/cosmos/slashing/slashing.proto | 23 + x/slashing/types/query.pb.go | 1422 ++++++++++++++++++++++++++ x/slashing/types/slashing.pb.go | 463 ++++++++- 4 files changed, 1929 insertions(+), 31 deletions(-) create mode 100644 proto/cosmos/slashing/query.proto create mode 100644 x/slashing/types/query.pb.go diff --git a/proto/cosmos/slashing/query.proto b/proto/cosmos/slashing/query.proto new file mode 100644 index 000000000000..58330432c044 --- /dev/null +++ b/proto/cosmos/slashing/query.proto @@ -0,0 +1,52 @@ +syntax = "proto3"; +package cosmos.slashing; + +import "cosmos/query/pagination.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/slashing/slashing.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/slashing/types"; + +// Query provides defines the gRPC querier service +service Query { + // Parameters queries the parameters of slashing module + rpc Parameters (QueryParametersRequest) returns (QueryParametersResponse){ } + + // SigningInfo queries the signing info of given cons address + rpc SigningInfo (QuerySigningInfoRequest) returns (QuerySigningInfoResponse) { } + + // SigningInfos queries signing info of all validators + rpc SigningInfos (QuerySigningInfosRequest) returns (QuerySigningInfosResponse) { } +} + +// QueryParametersRequest is the request type for the Query/Parameters RPC method +message QueryParametersRequest{ } + +// QueryParametersResponse is the response type for the Query/Parameters RPC method +message QueryParametersResponse{ + cosmos.slashing.Params params = 1; +} + +// QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC method +message QuerySigningInfoRequest{ + // cons_address is the address to query signing info of + bytes cons_address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ConsAddress"]; +} + +// QuerySigningInfoResponse is the response type for the Query/SigningInfo RPC method +message QuerySigningInfoResponse{ + // val_signing_info is the signing info of requested val cons address + cosmos.slashing.ValidatorSigningInfo val_signing_info = 1; +} + +// QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC method +message QuerySigningInfosRequest{ + cosmos.query.PageRequest req = 1; +} + +// QuerySigningInfosResponse is the response type for the Query/SigningInfos RPC method +message QuerySigningInfosResponse{ + // info is the signing info of all validators + repeated cosmos.slashing.ValidatorSigningInfo info = 1; + cosmos.query.PageResponse res =2; +} diff --git a/proto/cosmos/slashing/slashing.proto b/proto/cosmos/slashing/slashing.proto index 6f546a7d19a2..f5ad699eb6aa 100644 --- a/proto/cosmos/slashing/slashing.proto +++ b/proto/cosmos/slashing/slashing.proto @@ -5,6 +5,7 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/slashing/types"; option (gogoproto.equal_all) = true; import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; // MsgUnjail - struct for unjailing jailed validator @@ -40,3 +41,25 @@ message ValidatorSigningInfo { // missed blocks counter (to avoid scanning the array every time) int64 missed_blocks_counter = 6 [(gogoproto.moretags) = "yaml:\"missed_blocks_counter\""]; } + +// Params - used for initializing default parameter for slashing at genesis +message Params{ + int64 signed_blocks_window = 1 [(gogoproto.jsontag) = "json:\"signed_blocks_window\"", + (gogoproto.moretags) = "yaml:\"signed_blocks_window\""]; + bytes min_signed_per_window = 2 [(gogoproto.jsontag) = "json:\"min_signed_per_window\"", + (gogoproto.moretags) = "yaml:\"min_signed_per_window\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false]; + google.protobuf.Duration downtime_jail_duration = 3 [(gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "json:\"downtime_jail_duration\"", + (gogoproto.moretags) = "yaml:\"downtime_jail_duration\""]; + bytes slash_fraction_double_sign = 4 [(gogoproto.jsontag) = "json:\"slash_fraction_double_sign\"", + (gogoproto.moretags) = "yaml:\"slash_fraction_double_sign\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false]; + bytes slash_fraction_downtime = 5 [(gogoproto.jsontag) = "json:\"slash_fraction_downtime\"", + (gogoproto.moretags) = "yaml:\"slash_fraction_downtime\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/x/slashing/types/query.pb.go b/x/slashing/types/query.pb.go new file mode 100644 index 000000000000..606612963b71 --- /dev/null +++ b/x/slashing/types/query.pb.go @@ -0,0 +1,1422 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/slashing/query.proto + +package types + +import ( + context "context" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryParametersRequest is the request type for the Query/Parameters RPC method +type QueryParametersRequest struct { +} + +func (m *QueryParametersRequest) Reset() { *m = QueryParametersRequest{} } +func (m *QueryParametersRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParametersRequest) ProtoMessage() {} +func (*QueryParametersRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_12bf00fd6c136588, []int{0} +} +func (m *QueryParametersRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParametersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParametersRequest.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 *QueryParametersRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParametersRequest.Merge(m, src) +} +func (m *QueryParametersRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParametersRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParametersRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParametersRequest proto.InternalMessageInfo + +// QueryParametersResponse is the response type for the Query/Parameters RPC method +type QueryParametersResponse struct { + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (m *QueryParametersResponse) Reset() { *m = QueryParametersResponse{} } +func (m *QueryParametersResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParametersResponse) ProtoMessage() {} +func (*QueryParametersResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_12bf00fd6c136588, []int{1} +} +func (m *QueryParametersResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParametersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParametersResponse.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 *QueryParametersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParametersResponse.Merge(m, src) +} +func (m *QueryParametersResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParametersResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParametersResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParametersResponse proto.InternalMessageInfo + +func (m *QueryParametersResponse) GetParams() *Params { + if m != nil { + return m.Params + } + return nil +} + +// QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC method +type QuerySigningInfoRequest struct { + ConsAddress github_com_cosmos_cosmos_sdk_types.ConsAddress `protobuf:"bytes,1,opt,name=cons_address,json=consAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ConsAddress" json:"cons_address,omitempty"` +} + +func (m *QuerySigningInfoRequest) Reset() { *m = QuerySigningInfoRequest{} } +func (m *QuerySigningInfoRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySigningInfoRequest) ProtoMessage() {} +func (*QuerySigningInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_12bf00fd6c136588, []int{2} +} +func (m *QuerySigningInfoRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySigningInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySigningInfoRequest.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 *QuerySigningInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySigningInfoRequest.Merge(m, src) +} +func (m *QuerySigningInfoRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySigningInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySigningInfoRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySigningInfoRequest proto.InternalMessageInfo + +func (m *QuerySigningInfoRequest) GetConsAddress() github_com_cosmos_cosmos_sdk_types.ConsAddress { + if m != nil { + return m.ConsAddress + } + return nil +} + +// QuerySigningInfoResponse is the response type for the Query/SigningInfo RPC method +type QuerySigningInfoResponse struct { + ValSigningInfo *ValidatorSigningInfo `protobuf:"bytes,1,opt,name=val_signing_info,json=valSigningInfo,proto3" json:"val_signing_info,omitempty"` +} + +func (m *QuerySigningInfoResponse) Reset() { *m = QuerySigningInfoResponse{} } +func (m *QuerySigningInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySigningInfoResponse) ProtoMessage() {} +func (*QuerySigningInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_12bf00fd6c136588, []int{3} +} +func (m *QuerySigningInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySigningInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySigningInfoResponse.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 *QuerySigningInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySigningInfoResponse.Merge(m, src) +} +func (m *QuerySigningInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySigningInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySigningInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySigningInfoResponse proto.InternalMessageInfo + +func (m *QuerySigningInfoResponse) GetValSigningInfo() *ValidatorSigningInfo { + if m != nil { + return m.ValSigningInfo + } + return nil +} + +// QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC method +type QuerySigningInfosRequest struct { + Req *query.PageRequest `protobuf:"bytes,1,opt,name=req,proto3" json:"req,omitempty"` +} + +func (m *QuerySigningInfosRequest) Reset() { *m = QuerySigningInfosRequest{} } +func (m *QuerySigningInfosRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySigningInfosRequest) ProtoMessage() {} +func (*QuerySigningInfosRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_12bf00fd6c136588, []int{4} +} +func (m *QuerySigningInfosRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySigningInfosRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySigningInfosRequest.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 *QuerySigningInfosRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySigningInfosRequest.Merge(m, src) +} +func (m *QuerySigningInfosRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySigningInfosRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySigningInfosRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySigningInfosRequest proto.InternalMessageInfo + +func (m *QuerySigningInfosRequest) GetReq() *query.PageRequest { + if m != nil { + return m.Req + } + return nil +} + +// QuerySigningInfosResponse is the response type for the Query/SigningInfos RPC method +type QuerySigningInfosResponse struct { + Info []*ValidatorSigningInfo `protobuf:"bytes,1,rep,name=info,proto3" json:"info,omitempty"` + Res *query.PageResponse `protobuf:"bytes,2,opt,name=res,proto3" json:"res,omitempty"` +} + +func (m *QuerySigningInfosResponse) Reset() { *m = QuerySigningInfosResponse{} } +func (m *QuerySigningInfosResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySigningInfosResponse) ProtoMessage() {} +func (*QuerySigningInfosResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_12bf00fd6c136588, []int{5} +} +func (m *QuerySigningInfosResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySigningInfosResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySigningInfosResponse.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 *QuerySigningInfosResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySigningInfosResponse.Merge(m, src) +} +func (m *QuerySigningInfosResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySigningInfosResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySigningInfosResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySigningInfosResponse proto.InternalMessageInfo + +func (m *QuerySigningInfosResponse) GetInfo() []*ValidatorSigningInfo { + if m != nil { + return m.Info + } + return nil +} + +func (m *QuerySigningInfosResponse) GetRes() *query.PageResponse { + if m != nil { + return m.Res + } + return nil +} + +func init() { + proto.RegisterType((*QueryParametersRequest)(nil), "cosmos.slashing.QueryParametersRequest") + proto.RegisterType((*QueryParametersResponse)(nil), "cosmos.slashing.QueryParametersResponse") + proto.RegisterType((*QuerySigningInfoRequest)(nil), "cosmos.slashing.QuerySigningInfoRequest") + proto.RegisterType((*QuerySigningInfoResponse)(nil), "cosmos.slashing.QuerySigningInfoResponse") + proto.RegisterType((*QuerySigningInfosRequest)(nil), "cosmos.slashing.QuerySigningInfosRequest") + proto.RegisterType((*QuerySigningInfosResponse)(nil), "cosmos.slashing.QuerySigningInfosResponse") +} + +func init() { proto.RegisterFile("cosmos/slashing/query.proto", fileDescriptor_12bf00fd6c136588) } + +var fileDescriptor_12bf00fd6c136588 = []byte{ + // 452 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcd, 0x8e, 0xd3, 0x30, + 0x10, 0x4e, 0x76, 0x61, 0x0f, 0x6e, 0x05, 0xc8, 0x42, 0x6c, 0x36, 0x88, 0x80, 0x22, 0x21, 0x96, + 0x9f, 0x4d, 0xa4, 0x72, 0xe2, 0xc8, 0x72, 0x58, 0xc1, 0x85, 0x12, 0x04, 0x07, 0x2e, 0x95, 0x9b, + 0xb8, 0xae, 0xd5, 0xd4, 0x4e, 0x33, 0x69, 0x45, 0xef, 0x3c, 0x00, 0xaf, 0xc3, 0x1b, 0x70, 0xec, + 0x91, 0x13, 0x42, 0xed, 0x5b, 0x70, 0x42, 0xb1, 0x9d, 0x36, 0x6a, 0xca, 0xb6, 0x27, 0x8f, 0x3d, + 0xdf, 0x7c, 0xdf, 0x37, 0xf6, 0x18, 0xdd, 0x8f, 0x25, 0x8c, 0x25, 0x84, 0x90, 0x12, 0x18, 0x72, + 0xc1, 0xc2, 0xc9, 0x94, 0xe6, 0xf3, 0x20, 0x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0xb4, 0xb6, 0xf7, + 0xaf, 0x9a, 0x62, 0xd5, 0x35, 0xe2, 0xe7, 0xe8, 0x38, 0xa7, 0x13, 0xc3, 0x7f, 0x56, 0xf1, 0xeb, + 0x87, 0xee, 0x12, 0x46, 0x0d, 0x2e, 0x2a, 0x51, 0xfe, 0x37, 0x1b, 0x9d, 0xed, 0x60, 0x32, 0xbe, + 0x5f, 0xa1, 0x1b, 0xc6, 0xeb, 0xf1, 0xe1, 0x5e, 0x55, 0x09, 0x7e, 0x51, 0xba, 0x00, 0xe7, 0x48, + 0xb9, 0x70, 0x77, 0xb9, 0xd0, 0x1a, 0xa5, 0x0d, 0xe8, 0xfc, 0x38, 0x42, 0x37, 0x95, 0x0d, 0x4c, + 0x10, 0xda, 0xbc, 0x3f, 0x7e, 0xd2, 0x90, 0xdc, 0x3d, 0x3b, 0xee, 0xf9, 0x7e, 0xa0, 0xd6, 0xf3, + 0x2d, 0x9c, 0xa0, 0x56, 0xcd, 0x2f, 0xfe, 0x4f, 0x69, 0x73, 0x72, 0xdc, 0xa7, 0x07, 0x20, 0xd7, + 0x2a, 0x0c, 0xb5, 0xeb, 0x77, 0x8a, 0xf7, 0x17, 0xaf, 0x9b, 0x79, 0x76, 0x08, 0xb4, 0x12, 0xba, + 0xbc, 0xfa, 0xb9, 0xf4, 0xec, 0xc5, 0xd2, 0xb3, 0xff, 0x2c, 0x3d, 0xfb, 0xfb, 0xca, 0xb3, 0x16, + 0x2b, 0xcf, 0xfa, 0xb5, 0xf2, 0xac, 0x2f, 0x17, 0xd7, 0xce, 0xf3, 0xd7, 0xcd, 0x17, 0x55, 0xa3, + 0xdd, 0x3f, 0x51, 0x1f, 0xf4, 0xe5, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x13, 0x98, 0x88, 0xb6, + 0x25, 0x04, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Parameters queries the parameters of slashing module + Parameters(ctx context.Context, in *QueryParametersRequest, opts ...grpc.CallOption) (*QueryParametersResponse, error) + // SigningInfo queries the signing info of given cons address + SigningInfo(ctx context.Context, in *QuerySigningInfoRequest, opts ...grpc.CallOption) (*QuerySigningInfoResponse, error) + // SigningInfos queries signing info of all validators + SigningInfos(ctx context.Context, in *QuerySigningInfosRequest, opts ...grpc.CallOption) (*QuerySigningInfosResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Parameters(ctx context.Context, in *QueryParametersRequest, opts ...grpc.CallOption) (*QueryParametersResponse, error) { + out := new(QueryParametersResponse) + err := c.cc.Invoke(ctx, "/cosmos.slashing.Query/Parameters", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) SigningInfo(ctx context.Context, in *QuerySigningInfoRequest, opts ...grpc.CallOption) (*QuerySigningInfoResponse, error) { + out := new(QuerySigningInfoResponse) + err := c.cc.Invoke(ctx, "/cosmos.slashing.Query/SigningInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) SigningInfos(ctx context.Context, in *QuerySigningInfosRequest, opts ...grpc.CallOption) (*QuerySigningInfosResponse, error) { + out := new(QuerySigningInfosResponse) + err := c.cc.Invoke(ctx, "/cosmos.slashing.Query/SigningInfos", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of slashing module + Parameters(context.Context, *QueryParametersRequest) (*QueryParametersResponse, error) + // SigningInfo queries the signing info of given cons address + SigningInfo(context.Context, *QuerySigningInfoRequest) (*QuerySigningInfoResponse, error) + // SigningInfos queries signing info of all validators + SigningInfos(context.Context, *QuerySigningInfosRequest) (*QuerySigningInfosResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Parameters(ctx context.Context, req *QueryParametersRequest) (*QueryParametersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Parameters not implemented") +} +func (*UnimplementedQueryServer) SigningInfo(ctx context.Context, req *QuerySigningInfoRequest) (*QuerySigningInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SigningInfo not implemented") +} +func (*UnimplementedQueryServer) SigningInfos(ctx context.Context, req *QuerySigningInfosRequest) (*QuerySigningInfosResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SigningInfos not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Parameters_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParametersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Parameters(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.slashing.Query/Parameters", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Parameters(ctx, req.(*QueryParametersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_SigningInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySigningInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).SigningInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.slashing.Query/SigningInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).SigningInfo(ctx, req.(*QuerySigningInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_SigningInfos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySigningInfosRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).SigningInfos(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.slashing.Query/SigningInfos", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).SigningInfos(ctx, req.(*QuerySigningInfosRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.slashing.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Parameters", + Handler: _Query_Parameters_Handler, + }, + { + MethodName: "SigningInfo", + Handler: _Query_SigningInfo_Handler, + }, + { + MethodName: "SigningInfos", + Handler: _Query_SigningInfos_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/slashing/query.proto", +} + +func (m *QueryParametersRequest) 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 *QueryParametersRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParametersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParametersResponse) 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 *QueryParametersResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParametersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Params != nil { + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QuerySigningInfoRequest) 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 *QuerySigningInfoRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySigningInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ConsAddress) > 0 { + i -= len(m.ConsAddress) + copy(dAtA[i:], m.ConsAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ConsAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QuerySigningInfoResponse) 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 *QuerySigningInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySigningInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ValSigningInfo != nil { + { + size, err := m.ValSigningInfo.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 *QuerySigningInfosRequest) 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 *QuerySigningInfosRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySigningInfosRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Req != nil { + { + size, err := m.Req.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 *QuerySigningInfosResponse) 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 *QuerySigningInfosResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySigningInfosResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Res != nil { + { + size, err := m.Res.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Info) > 0 { + for iNdEx := len(m.Info) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Info[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParametersRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParametersResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySigningInfoRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ConsAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySigningInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ValSigningInfo != nil { + l = m.ValSigningInfo.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySigningInfosRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Req != nil { + l = m.Req.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySigningInfosResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Info) > 0 { + for _, e := range m.Info { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Res != nil { + l = m.Res.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParametersRequest) 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: QueryParametersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParametersRequest: 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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParametersResponse) 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: QueryParametersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParametersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Params == nil { + m.Params = &Params{} + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySigningInfoRequest) 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: QuerySigningInfoRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySigningInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsAddress = append(m.ConsAddress[:0], dAtA[iNdEx:postIndex]...) + if m.ConsAddress == nil { + m.ConsAddress = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySigningInfoResponse) 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: QuerySigningInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySigningInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValSigningInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ValSigningInfo == nil { + m.ValSigningInfo = &ValidatorSigningInfo{} + } + if err := m.ValSigningInfo.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySigningInfosRequest) 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: QuerySigningInfosRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySigningInfosRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Req", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Req == nil { + m.Req = &query.PageRequest{} + } + if err := m.Req.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySigningInfosResponse) 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: QuerySigningInfosResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySigningInfosResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Info", 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 + } + m.Info = append(m.Info, &ValidatorSigningInfo{}) + if err := m.Info[len(m.Info)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Res", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Res == nil { + m.Res = &query.PageResponse{} + } + if err := m.Res.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/slashing/types/slashing.pb.go b/x/slashing/types/slashing.pb.go index ffc106bfb167..784a6da3f33d 100644 --- a/x/slashing/types/slashing.pb.go +++ b/x/slashing/types/slashing.pb.go @@ -10,6 +10,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "github.com/golang/protobuf/ptypes/duration" _ "github.com/golang/protobuf/ptypes/timestamp" io "io" math "math" @@ -163,45 +164,119 @@ func (m *ValidatorSigningInfo) GetMissedBlocksCounter() int64 { return 0 } +// Params - used for initializing default parameter for slashing at genesis +type Params struct { + SignedBlocksWindow int64 `protobuf:"varint,1,opt,name=signed_blocks_window,json=signedBlocksWindow,proto3" json:"json:\"signed_blocks_window\"" yaml:"signed_blocks_window"` + MinSignedPerWindow github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=min_signed_per_window,json=minSignedPerWindow,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"json:\"min_signed_per_window\"" yaml:"min_signed_per_window"` + DowntimeJailDuration time.Duration `protobuf:"bytes,3,opt,name=downtime_jail_duration,json=downtimeJailDuration,proto3,stdduration" json:"json:\"downtime_jail_duration\"" yaml:"downtime_jail_duration"` + SlashFractionDoubleSign github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=slash_fraction_double_sign,json=slashFractionDoubleSign,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"json:\"slash_fraction_double_sign\"" yaml:"slash_fraction_double_sign"` + SlashFractionDowntime github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=slash_fraction_downtime,json=slashFractionDowntime,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"json:\"slash_fraction_downtime\"" yaml:"slash_fraction_downtime"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_3d04e6c6c2071212, []int{2} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetSignedBlocksWindow() int64 { + if m != nil { + return m.SignedBlocksWindow + } + return 0 +} + +func (m *Params) GetDowntimeJailDuration() time.Duration { + if m != nil { + return m.DowntimeJailDuration + } + return 0 +} + func init() { proto.RegisterType((*MsgUnjail)(nil), "cosmos.slashing.MsgUnjail") proto.RegisterType((*ValidatorSigningInfo)(nil), "cosmos.slashing.ValidatorSigningInfo") + proto.RegisterType((*Params)(nil), "cosmos.slashing.Params") } func init() { proto.RegisterFile("cosmos/slashing/slashing.proto", fileDescriptor_3d04e6c6c2071212) } var fileDescriptor_3d04e6c6c2071212 = []byte{ - // 476 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xbf, 0x6f, 0xd4, 0x30, - 0x14, 0xc7, 0xcf, 0x1c, 0x94, 0xe2, 0x3b, 0x8a, 0x94, 0x16, 0x11, 0x9d, 0x90, 0x1d, 0x65, 0xba, - 0xa5, 0x89, 0x54, 0xb6, 0xdb, 0x48, 0x17, 0x10, 0xbf, 0xa4, 0xd0, 0x76, 0x60, 0x20, 0x72, 0x2e, - 0x3e, 0x9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f, 0xe9, 0x68, 0xf3, - 0xf3, 0x39, 0xee, 0xfc, 0x3c, 0xc7, 0x20, 0x7a, 0xf1, 0x65, 0x8e, 0xc0, 0xc5, 0x1c, 0x81, 0xcb, - 0x39, 0x02, 0x3f, 0xe6, 0x08, 0x9c, 0x2d, 0x50, 0xe7, 0x72, 0x81, 0x3a, 0xdf, 0x16, 0xa8, 0xf3, - 0xee, 0xdf, 0xa3, 0x71, 0x72, 0x33, 0xe1, 0xa6, 0x73, 0xe9, 0x86, 0xf9, 0x8e, 0x27, 0xbf, 0x03, - 0x00, 0x00, 0xff, 0xff, 0xe3, 0x3b, 0x55, 0x14, 0x01, 0x03, 0x00, 0x00, + // 738 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0x3d, 0x4f, 0xdb, 0x5a, + 0x18, 0xce, 0x21, 0xf7, 0xe6, 0x72, 0x9d, 0x5c, 0xae, 0x64, 0x42, 0x49, 0x03, 0xf8, 0x04, 0x0f, + 0x55, 0x16, 0x1c, 0x89, 0x6e, 0x19, 0x2a, 0xd5, 0xa0, 0xaa, 0xa5, 0x5f, 0xc8, 0x7c, 0x54, 0xea, + 0x50, 0xcb, 0x89, 0x1d, 0xe7, 0x80, 0x7d, 0x4e, 0xe4, 0x73, 0x52, 0x60, 0xed, 0x2f, 0x60, 0x44, + 0xea, 0x02, 0x5b, 0xd5, 0xbd, 0x5b, 0x7f, 0x00, 0x23, 0x63, 0xd5, 0xc1, 0xad, 0xc2, 0x52, 0x65, + 0xcc, 0xc8, 0x54, 0x9d, 0x73, 0x6c, 0x88, 0x20, 0xa9, 0x60, 0x8a, 0xdf, 0xe7, 0x79, 0x3f, 0x9e, + 0xf7, 0xc3, 0x8e, 0xa2, 0x35, 0x09, 0x0d, 0x09, 0xad, 0xd1, 0xc0, 0xa1, 0x6d, 0x84, 0xfd, 0xcb, + 0x07, 0xa3, 0x13, 0x11, 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, 0x07, 0x31, 0x9c, 0x96, + 0x0d, 0x0d, 0xb3, 0xba, 0x95, 0x17, 0xe6, 0x53, 0x61, 0xf1, 0x58, 0x84, 0x5d, 0x6f, 0xdf, 0x26, + 0xad, 0x16, 0xf5, 0x58, 0x29, 0x7b, 0x3d, 0x76, 0x98, 0xd5, 0xad, 0xbc, 0x30, 0x5f, 0x0b, 0x4b, + 0x7d, 0xa7, 0x14, 0xf8, 0x74, 0x3d, 0xd7, 0xee, 0x62, 0x86, 0x82, 0xd2, 0x5f, 0x15, 0x50, 0xcd, + 0x2f, 0x97, 0x0d, 0xb9, 0x1b, 0x23, 0xdd, 0x8d, 0xb1, 0x99, 0xee, 0xc6, 0x84, 0xa7, 0x31, 0xcc, + 0x5c, 0xe5, 0x1e, 0x8e, 0xd6, 0x0f, 0x7f, 0x40, 0x60, 0xe5, 0x25, 0xb4, 0xc5, 0x11, 0x55, 0x53, + 0x14, 0x46, 0xc2, 0x06, 0x65, 0x04, 0x7b, 0x6e, 0xe9, 0xef, 0x0a, 0xa8, 0x4e, 0x5a, 0x43, 0x88, + 0xba, 0xa9, 0xcc, 0x84, 0x88, 0x52, 0xcf, 0xb5, 0x1b, 0x01, 0x69, 0xee, 0x52, 0xbb, 0x49, 0xba, + 0x98, 0x79, 0x51, 0x29, 0x27, 0x9a, 0xa8, 0x0c, 0x62, 0x38, 0x2f, 0x0b, 0x8d, 0x74, 0xd3, 0xad, + 0x69, 0x89, 0x9b, 0x02, 0x5e, 0x91, 0x68, 0x7d, 0xf2, 0xe8, 0x18, 0x66, 0x7e, 0x1d, 0x43, 0xa0, + 0x9f, 0xe4, 0x94, 0xdc, 0xba, 0x13, 0x39, 0x21, 0x55, 0x3b, 0x4a, 0x91, 0x22, 0x1f, 0x5f, 0xe5, + 0xd8, 0x43, 0xd8, 0x25, 0x7b, 0x62, 0x7b, 0x59, 0xf3, 0x51, 0x3f, 0x86, 0x73, 0x3b, 0x94, 0xe0, + 0xba, 0x3e, 0xca, 0x4b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0x68, 0x6d, 0x8c, 0x68, 0x99, 0x96, 0x2b, + 0xd6, 0xc6, 0x28, 0x4e, 0x3c, 0xac, 0x99, 0x6b, 0x72, 0x25, 0x6e, 0x3e, 0xff, 0xd4, 0xd3, 0xc0, + 0x69, 0x4f, 0x03, 0x67, 0x3d, 0x0d, 0xfc, 0xec, 0x69, 0xe0, 0xf0, 0x5c, 0xcb, 0x9c, 0x9d, 0x6b, + 0x99, 0x6f, 0xe7, 0x5a, 0xe6, 0xed, 0x9f, 0x3f, 0x9f, 0xfb, 0x57, 0xff, 0x12, 0x42, 0x6b, 0x23, + 0x27, 0xce, 0xe4, 0xe1, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd1, 0x65, 0xdc, 0x1c, 0x45, 0x06, + 0x00, 0x00, } func (this *MsgUnjail) Equal(that interface{}) bool { @@ -267,6 +342,42 @@ func (this *ValidatorSigningInfo) Equal(that interface{}) bool { } return true } +func (this *Params) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Params) + if !ok { + that2, ok := that.(Params) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.SignedBlocksWindow != that1.SignedBlocksWindow { + return false + } + if !this.MinSignedPerWindow.Equal(that1.MinSignedPerWindow) { + return false + } + if this.DowntimeJailDuration != that1.DowntimeJailDuration { + return false + } + if !this.SlashFractionDoubleSign.Equal(that1.SlashFractionDoubleSign) { + return false + } + if !this.SlashFractionDowntime.Equal(that1.SlashFractionDowntime) { + return false + } + return true +} func (m *MsgUnjail) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -360,6 +471,72 @@ func (m *ValidatorSigningInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.SlashFractionDowntime.Size() + i -= size + if _, err := m.SlashFractionDowntime.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintSlashing(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size := m.SlashFractionDoubleSign.Size() + i -= size + if _, err := m.SlashFractionDoubleSign.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintSlashing(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.DowntimeJailDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.DowntimeJailDuration):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintSlashing(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x1a + { + size := m.MinSignedPerWindow.Size() + i -= size + if _, err := m.MinSignedPerWindow.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintSlashing(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.SignedBlocksWindow != 0 { + i = encodeVarintSlashing(dAtA, i, uint64(m.SignedBlocksWindow)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintSlashing(dAtA []byte, offset int, v uint64) int { offset -= sovSlashing(v) base := offset @@ -411,6 +588,26 @@ func (m *ValidatorSigningInfo) Size() (n int) { return n } +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SignedBlocksWindow != 0 { + n += 1 + sovSlashing(uint64(m.SignedBlocksWindow)) + } + l = m.MinSignedPerWindow.Size() + n += 1 + l + sovSlashing(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.DowntimeJailDuration) + n += 1 + l + sovSlashing(uint64(l)) + l = m.SlashFractionDoubleSign.Size() + n += 1 + l + sovSlashing(uint64(l)) + l = m.SlashFractionDowntime.Size() + n += 1 + l + sovSlashing(uint64(l)) + return n +} + func sovSlashing(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -701,6 +898,210 @@ func (m *ValidatorSigningInfo) Unmarshal(dAtA []byte) error { } return nil } +func (m *Params) 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 ErrIntOverflowSlashing + } + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SignedBlocksWindow", wireType) + } + m.SignedBlocksWindow = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSlashing + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SignedBlocksWindow |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinSignedPerWindow", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSlashing + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthSlashing + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthSlashing + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinSignedPerWindow.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DowntimeJailDuration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSlashing + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSlashing + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSlashing + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.DowntimeJailDuration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SlashFractionDoubleSign", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSlashing + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthSlashing + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthSlashing + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SlashFractionDoubleSign.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SlashFractionDowntime", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSlashing + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthSlashing + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthSlashing + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SlashFractionDowntime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSlashing(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSlashing + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSlashing + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipSlashing(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From ef057a3e88b86dd7a944f083fed577a1a3c603fd Mon Sep 17 00:00:00 2001 From: sahith-narahari Date: Mon, 29 Jun 2020 23:45:47 +0530 Subject: [PATCH 2/8] Add slashing grpc queries --- proto/cosmos/slashing/query.proto | 2 +- x/slashing/keeper/grpc_query.go | 47 ++++++++++++++++++++++++++++ x/slashing/keeper/grpc_query_test.go | 1 + x/slashing/types/query.pb.go | 3 ++ 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 x/slashing/keeper/grpc_query.go create mode 100644 x/slashing/keeper/grpc_query_test.go diff --git a/proto/cosmos/slashing/query.proto b/proto/cosmos/slashing/query.proto index 58330432c044..ba45aa5e65ee 100644 --- a/proto/cosmos/slashing/query.proto +++ b/proto/cosmos/slashing/query.proto @@ -10,7 +10,7 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/slashing/types"; // Query provides defines the gRPC querier service service Query { // Parameters queries the parameters of slashing module - rpc Parameters (QueryParametersRequest) returns (QueryParametersResponse){ } + rpc Params (QueryParametersRequest) returns (QueryParametersResponse){ } // SigningInfo queries the signing info of given cons address rpc SigningInfo (QuerySigningInfoRequest) returns (QuerySigningInfoResponse) { } diff --git a/x/slashing/keeper/grpc_query.go b/x/slashing/keeper/grpc_query.go new file mode 100644 index 000000000000..4854f77e565c --- /dev/null +++ b/x/slashing/keeper/grpc_query.go @@ -0,0 +1,47 @@ +package keeper + +import ( + "context" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/slashing/types" +) + +// var _ types.QueryServer = Keeper{} + +func (k Keeper) Params(c context.Context, req *types.QueryParametersRequest) (*types.QueryParametersResponse, error) { + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(c) + params := k.GetParams(ctx) + + return &types.QueryParametersResponse{Params: ¶ms}, nil +} + +func (k Keeper) SigninInfo(c context.Context, req *types.QuerySigningInfoRequest) (*types.QuerySigningInfoResponse, error) { + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(c) + signingInfo, found := k.GetValidatorSigningInfo(ctx, req.ConsAddress) + if !found { + return nil, status.Errorf(codes.NotFound, "SigningInfo not found for validator %s", req.ConsAddress) + } + + return &types.QuerySigningInfoResponse{ValSigningInfo: &signingInfo}, nil +} + +func (k Keeper) signingInfos(c context.Context, req *types.QuerySigningInfosRequest) (*types.QuerySigningInfosResponse, error) { + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(c) + return nil, nil +} diff --git a/x/slashing/keeper/grpc_query_test.go b/x/slashing/keeper/grpc_query_test.go new file mode 100644 index 000000000000..b55569d4a442 --- /dev/null +++ b/x/slashing/keeper/grpc_query_test.go @@ -0,0 +1 @@ +package keeper diff --git a/x/slashing/types/query.pb.go b/x/slashing/types/query.pb.go index 606612963b71..f7082bbb2d1f 100644 --- a/x/slashing/types/query.pb.go +++ b/x/slashing/types/query.pb.go @@ -114,6 +114,7 @@ func (m *QueryParametersResponse) GetParams() *Params { // QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC method type QuerySigningInfoRequest struct { + // cons_address is the address to query signing info of ConsAddress github_com_cosmos_cosmos_sdk_types.ConsAddress `protobuf:"bytes,1,opt,name=cons_address,json=consAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ConsAddress" json:"cons_address,omitempty"` } @@ -159,6 +160,7 @@ func (m *QuerySigningInfoRequest) GetConsAddress() github_com_cosmos_cosmos_sdk_ // QuerySigningInfoResponse is the response type for the Query/SigningInfo RPC method type QuerySigningInfoResponse struct { + // val_signing_info is the signing info of requested val cons address ValSigningInfo *ValidatorSigningInfo `protobuf:"bytes,1,opt,name=val_signing_info,json=valSigningInfo,proto3" json:"val_signing_info,omitempty"` } @@ -249,6 +251,7 @@ func (m *QuerySigningInfosRequest) GetReq() *query.PageRequest { // QuerySigningInfosResponse is the response type for the Query/SigningInfos RPC method type QuerySigningInfosResponse struct { + // info is the signing info of all validators Info []*ValidatorSigningInfo `protobuf:"bytes,1,rep,name=info,proto3" json:"info,omitempty"` Res *query.PageResponse `protobuf:"bytes,2,opt,name=res,proto3" json:"res,omitempty"` } From 2d29b9b07aefe666f0d59b8e59a1ad9182e1a03c Mon Sep 17 00:00:00 2001 From: sahith-narahari Date: Thu, 2 Jul 2020 19:29:37 +0530 Subject: [PATCH 3/8] Add tests --- proto/cosmos/slashing/query.proto | 8 +- x/slashing/keeper/grpc_query.go | 12 +- x/slashing/keeper/grpc_query_test.go | 30 +++- x/slashing/types/query.pb.go | 209 +++++++++++++-------------- 4 files changed, 140 insertions(+), 119 deletions(-) diff --git a/proto/cosmos/slashing/query.proto b/proto/cosmos/slashing/query.proto index ba45aa5e65ee..4e7c027a9bc0 100644 --- a/proto/cosmos/slashing/query.proto +++ b/proto/cosmos/slashing/query.proto @@ -10,7 +10,7 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/slashing/types"; // Query provides defines the gRPC querier service service Query { // Parameters queries the parameters of slashing module - rpc Params (QueryParametersRequest) returns (QueryParametersResponse){ } + rpc Params (QueryParamsRequest) returns (QueryParamsResponse){ } // SigningInfo queries the signing info of given cons address rpc SigningInfo (QuerySigningInfoRequest) returns (QuerySigningInfoResponse) { } @@ -20,11 +20,11 @@ service Query { } // QueryParametersRequest is the request type for the Query/Parameters RPC method -message QueryParametersRequest{ } +message QueryParamsRequest{ } // QueryParametersResponse is the response type for the Query/Parameters RPC method -message QueryParametersResponse{ - cosmos.slashing.Params params = 1; +message QueryParamsResponse{ + cosmos.slashing.Params params = 1[(gogoproto.nullable) = false]; } // QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC method diff --git a/x/slashing/keeper/grpc_query.go b/x/slashing/keeper/grpc_query.go index 4854f77e565c..e62796091bb6 100644 --- a/x/slashing/keeper/grpc_query.go +++ b/x/slashing/keeper/grpc_query.go @@ -10,9 +10,9 @@ import ( "github.com/cosmos/cosmos-sdk/x/slashing/types" ) -// var _ types.QueryServer = Keeper{} +var _ types.QueryServer = Keeper{} -func (k Keeper) Params(c context.Context, req *types.QueryParametersRequest) (*types.QueryParametersResponse, error) { +func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { if req == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } @@ -20,10 +20,10 @@ func (k Keeper) Params(c context.Context, req *types.QueryParametersRequest) (*t ctx := sdk.UnwrapSDKContext(c) params := k.GetParams(ctx) - return &types.QueryParametersResponse{Params: ¶ms}, nil + return &types.QueryParamsResponse{Params: ¶ms}, nil } -func (k Keeper) SigninInfo(c context.Context, req *types.QuerySigningInfoRequest) (*types.QuerySigningInfoResponse, error) { +func (k Keeper) SigningInfo(c context.Context, req *types.QuerySigningInfoRequest) (*types.QuerySigningInfoResponse, error) { if req == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } @@ -37,11 +37,11 @@ func (k Keeper) SigninInfo(c context.Context, req *types.QuerySigningInfoRequest return &types.QuerySigningInfoResponse{ValSigningInfo: &signingInfo}, nil } -func (k Keeper) signingInfos(c context.Context, req *types.QuerySigningInfosRequest) (*types.QuerySigningInfosResponse, error) { +func (k Keeper) SigningInfos(c context.Context, req *types.QuerySigningInfosRequest) (*types.QuerySigningInfosResponse, error) { if req == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } - ctx := sdk.UnwrapSDKContext(c) + _ := sdk.UnwrapSDKContext(c) return nil, nil } diff --git a/x/slashing/keeper/grpc_query_test.go b/x/slashing/keeper/grpc_query_test.go index b55569d4a442..6ad9bd0ed226 100644 --- a/x/slashing/keeper/grpc_query_test.go +++ b/x/slashing/keeper/grpc_query_test.go @@ -1 +1,29 @@ -package keeper +package keeper_test + +import ( + gocontext "context" + "testing" + + "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/simapp" + "github.com/cosmos/cosmos-sdk/x/slashing/keeper" + "github.com/cosmos/cosmos-sdk/x/slashing/types" +) + +func TestGRPCQueryParams(t *testing.T) { + app := simapp.Setup(false) + ctx := app.BaseApp.NewContext(false, abci.Header{}) + app.SlashingKeeper.SetParams(ctx, keeper.TestParams()) + + queryHelper := baseapp.NewQueryServerTestHelper(ctx) + types.RegisterQueryServer(queryHelper, app.SlashingKeeper) + queryClient := types.NewQueryClient(queryHelper) + + params, err := queryClient.Params(gocontext.Background(), &types.QueryParamsRequest{}) + require.NoError(t, err) + + require.Equal(t, keeper.TestParams(), params) +} diff --git a/x/slashing/types/query.pb.go b/x/slashing/types/query.pb.go index f7082bbb2d1f..01dd677c0219 100644 --- a/x/slashing/types/query.pb.go +++ b/x/slashing/types/query.pb.go @@ -31,21 +31,21 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // QueryParametersRequest is the request type for the Query/Parameters RPC method -type QueryParametersRequest struct { +type QueryParamsRequest struct { } -func (m *QueryParametersRequest) Reset() { *m = QueryParametersRequest{} } -func (m *QueryParametersRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParametersRequest) ProtoMessage() {} -func (*QueryParametersRequest) Descriptor() ([]byte, []int) { +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_12bf00fd6c136588, []int{0} } -func (m *QueryParametersRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryParametersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryParametersRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -55,35 +55,35 @@ func (m *QueryParametersRequest) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *QueryParametersRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParametersRequest.Merge(m, src) +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) } -func (m *QueryParametersRequest) XXX_Size() int { +func (m *QueryParamsRequest) XXX_Size() int { return m.Size() } -func (m *QueryParametersRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParametersRequest.DiscardUnknown(m) +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryParametersRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo // QueryParametersResponse is the response type for the Query/Parameters RPC method -type QueryParametersResponse struct { - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +type QueryParamsResponse struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } -func (m *QueryParametersResponse) Reset() { *m = QueryParametersResponse{} } -func (m *QueryParametersResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParametersResponse) ProtoMessage() {} -func (*QueryParametersResponse) Descriptor() ([]byte, []int) { +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_12bf00fd6c136588, []int{1} } -func (m *QueryParametersResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryParametersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryParametersResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -93,23 +93,23 @@ func (m *QueryParametersResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *QueryParametersResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParametersResponse.Merge(m, src) +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) } -func (m *QueryParametersResponse) XXX_Size() int { +func (m *QueryParamsResponse) XXX_Size() int { return m.Size() } -func (m *QueryParametersResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParametersResponse.DiscardUnknown(m) +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryParametersResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo -func (m *QueryParametersResponse) GetParams() *Params { +func (m *QueryParamsResponse) GetParams() Params { if m != nil { return m.Params } - return nil + return Params{} } // QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC method @@ -304,8 +304,8 @@ func (m *QuerySigningInfosResponse) GetRes() *query.PageResponse { } func init() { - proto.RegisterType((*QueryParametersRequest)(nil), "cosmos.slashing.QueryParametersRequest") - proto.RegisterType((*QueryParametersResponse)(nil), "cosmos.slashing.QueryParametersResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.slashing.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.slashing.QueryParamsResponse") proto.RegisterType((*QuerySigningInfoRequest)(nil), "cosmos.slashing.QuerySigningInfoRequest") proto.RegisterType((*QuerySigningInfoResponse)(nil), "cosmos.slashing.QuerySigningInfoResponse") proto.RegisterType((*QuerySigningInfosRequest)(nil), "cosmos.slashing.QuerySigningInfosRequest") @@ -315,36 +315,36 @@ func init() { func init() { proto.RegisterFile("cosmos/slashing/query.proto", fileDescriptor_12bf00fd6c136588) } var fileDescriptor_12bf00fd6c136588 = []byte{ - // 452 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcd, 0x8e, 0xd3, 0x30, - 0x10, 0x4e, 0x76, 0x61, 0x0f, 0x6e, 0x05, 0xc8, 0x42, 0x6c, 0x36, 0x88, 0x80, 0x22, 0x21, 0x96, - 0x9f, 0x4d, 0xa4, 0x72, 0xe2, 0xc8, 0x72, 0x58, 0xc1, 0x85, 0x12, 0x04, 0x07, 0x2e, 0x95, 0x9b, - 0xb8, 0xae, 0xd5, 0xd4, 0x4e, 0x33, 0x69, 0x45, 0xef, 0x3c, 0x00, 0xaf, 0xc3, 0x1b, 0x70, 0xec, - 0x91, 0x13, 0x42, 0xed, 0x5b, 0x70, 0x42, 0xb1, 0x9d, 0x36, 0x6a, 0xca, 0xb6, 0x27, 0x8f, 0x3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 0x00, 0xff, 0xff, 0x13, 0x98, 0x88, 0xb6, - 0x25, 0x04, 0x00, 0x00, + // 460 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xb6, 0xdb, 0x92, 0xc3, 0x26, 0x02, 0xb4, 0x54, 0x6a, 0x6a, 0x84, 0x8b, 0x0c, 0x48, 0xe5, + 0xa7, 0xb6, 0x14, 0xc4, 0x81, 0x23, 0xe1, 0x50, 0x21, 0x21, 0x51, 0x8c, 0xca, 0x81, 0x4b, 0xb4, + 0xb5, 0xb7, 0xdb, 0x55, 0x9d, 0x5d, 0xc7, 0xe3, 0x54, 0xe4, 0xce, 0x03, 0xf0, 0x22, 0xbc, 0x47, + 0x8e, 0x39, 0x72, 0x8a, 0x50, 0xf2, 0x16, 0x9c, 0x90, 0x77, 0xd7, 0x89, 0x89, 0xa3, 0x34, 0x27, + 0x8f, 0x67, 0xbe, 0xf9, 0xbe, 0x6f, 0x76, 0x67, 0xd1, 0xc3, 0x48, 0x42, 0x5f, 0x42, 0x00, 0x09, + 0x81, 0x2b, 0x2e, 0x58, 0x30, 0x18, 0xd2, 0x6c, 0xe4, 0xa7, 0x99, 0xcc, 0x25, 0xbe, 0xa7, 0x8b, + 0x7e, 0x59, 0x74, 0x1e, 0x19, 0xb4, 0x02, 0x05, 0x29, 0x61, 0x5c, 0x90, 0x9c, 0x4b, 0xa1, 0xf1, + 0xce, 0x3e, 0x93, 0x4c, 0xaa, 0x30, 0x28, 0x22, 0x93, 0x75, 0x57, 0x25, 0xca, 0x40, 0xd7, 0xbd, + 0x7d, 0x84, 0x3f, 0x17, 0x7c, 0x67, 0x24, 0x23, 0x7d, 0x08, 0xe9, 0x60, 0x48, 0x21, 0xf7, 0x3e, + 0xa2, 0x07, 0xff, 0x65, 0x21, 0x95, 0x02, 0x28, 0x7e, 0x83, 0x1a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f3, 0x6b, 0x07, 0xdd, 0x51, 0x36, 0xf0, 0x39, 0x6a, 0xe8, 0x0b, 0xc5, 0x4f, 0x6a, 0x72, 0xf5, + 0xad, 0x71, 0x9e, 0x6e, 0x06, 0x69, 0x0d, 0xcf, 0xc2, 0x31, 0x6a, 0x56, 0x3c, 0xe2, 0xe3, 0xf5, + 0x6d, 0xf5, 0x6d, 0x71, 0x9e, 0x6f, 0x81, 0x5c, 0xa8, 0x30, 0xd4, 0xaa, 0x9e, 0x23, 0xbe, 0xbd, + 0x79, 0x31, 0xc8, 0x8b, 0x6d, 0xa0, 0xa5, 0x50, 0xf7, 0x74, 0x3c, 0x73, 0xed, 0xc9, 0xcc, 0xb5, + 0xff, 0xcc, 0x5c, 0xfb, 0xe7, 0xdc, 0xb5, 0x26, 0x73, 0xd7, 0xfa, 0x3d, 0x77, 0xad, 0x6f, 0x27, + 0x1b, 0x77, 0xf8, 0xfb, 0xf2, 0x51, 0xaa, 0x75, 0xbe, 0x68, 0xa8, 0x27, 0xf9, 0xfa, 0x5f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x32, 0x0d, 0x33, 0x0f, 0x17, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -360,7 +360,7 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { // Parameters queries the parameters of slashing module - Parameters(ctx context.Context, in *QueryParametersRequest, opts ...grpc.CallOption) (*QueryParametersResponse, error) + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // SigningInfo queries the signing info of given cons address SigningInfo(ctx context.Context, in *QuerySigningInfoRequest, opts ...grpc.CallOption) (*QuerySigningInfoResponse, error) // SigningInfos queries signing info of all validators @@ -375,9 +375,9 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) Parameters(ctx context.Context, in *QueryParametersRequest, opts ...grpc.CallOption) (*QueryParametersResponse, error) { - out := new(QueryParametersResponse) - err := c.cc.Invoke(ctx, "/cosmos.slashing.Query/Parameters", in, out, opts...) +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/cosmos.slashing.Query/Params", in, out, opts...) if err != nil { return nil, err } @@ -405,7 +405,7 @@ func (c *queryClient) SigningInfos(ctx context.Context, in *QuerySigningInfosReq // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of slashing module - Parameters(context.Context, *QueryParametersRequest) (*QueryParametersResponse, error) + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // SigningInfo queries the signing info of given cons address SigningInfo(context.Context, *QuerySigningInfoRequest) (*QuerySigningInfoResponse, error) // SigningInfos queries signing info of all validators @@ -416,8 +416,8 @@ type QueryServer interface { type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) Parameters(ctx context.Context, req *QueryParametersRequest) (*QueryParametersResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Parameters not implemented") +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } func (*UnimplementedQueryServer) SigningInfo(ctx context.Context, req *QuerySigningInfoRequest) (*QuerySigningInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SigningInfo not implemented") @@ -430,20 +430,20 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_Parameters_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParametersRequest) +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).Parameters(ctx, in) + return srv.(QueryServer).Params(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmos.slashing.Query/Parameters", + FullMethod: "/cosmos.slashing.Query/Params", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Parameters(ctx, req.(*QueryParametersRequest)) + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) } return interceptor(ctx, in, info, handler) } @@ -489,8 +489,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "Parameters", - Handler: _Query_Parameters_Handler, + MethodName: "Params", + Handler: _Query_Params_Handler, }, { MethodName: "SigningInfo", @@ -505,7 +505,7 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Metadata: "cosmos/slashing/query.proto", } -func (m *QueryParametersRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -515,12 +515,12 @@ func (m *QueryParametersRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryParametersRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryParametersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -528,7 +528,7 @@ func (m *QueryParametersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryParametersResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -538,28 +538,26 @@ func (m *QueryParametersResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryParametersResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryParametersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Params != nil { - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -723,7 +721,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *QueryParametersRequest) Size() (n int) { +func (m *QueryParamsRequest) Size() (n int) { if m == nil { return 0 } @@ -732,16 +730,14 @@ func (m *QueryParametersRequest) Size() (n int) { return n } -func (m *QueryParametersResponse) Size() (n int) { +func (m *QueryParamsResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Params != nil { - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - } + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) return n } @@ -809,7 +805,7 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QueryParametersRequest) Unmarshal(dAtA []byte) error { +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -832,10 +828,10 @@ func (m *QueryParametersRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParametersRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParametersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -862,7 +858,7 @@ func (m *QueryParametersRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryParametersResponse) Unmarshal(dAtA []byte) error { +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -885,10 +881,10 @@ func (m *QueryParametersResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParametersResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParametersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -920,9 +916,6 @@ func (m *QueryParametersResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Params == nil { - m.Params = &Params{} - } if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } From a675c8adbd58a1bd2a5e8087e9b34c02c042f5b1 Mon Sep 17 00:00:00 2001 From: sahith-narahari Date: Thu, 2 Jul 2020 19:34:45 +0530 Subject: [PATCH 4/8] Remove duplicate declarations --- proto/cosmos/slashing/query.proto | 8 ++++---- x/slashing/keeper/grpc_query.go | 4 ++-- x/slashing/keeper/grpc_query_test.go | 4 ++-- x/slashing/types/params.go | 22 ---------------------- 4 files changed, 8 insertions(+), 30 deletions(-) diff --git a/proto/cosmos/slashing/query.proto b/proto/cosmos/slashing/query.proto index 4e7c027a9bc0..4927d53c9e0a 100644 --- a/proto/cosmos/slashing/query.proto +++ b/proto/cosmos/slashing/query.proto @@ -10,17 +10,17 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/slashing/types"; // Query provides defines the gRPC querier service service Query { // Parameters queries the parameters of slashing module - rpc Params (QueryParamsRequest) returns (QueryParamsResponse){ } + rpc Params (QueryParamsRequest) returns (QueryParamsResponse){} // SigningInfo queries the signing info of given cons address - rpc SigningInfo (QuerySigningInfoRequest) returns (QuerySigningInfoResponse) { } + rpc SigningInfo (QuerySigningInfoRequest) returns (QuerySigningInfoResponse) {} // SigningInfos queries signing info of all validators - rpc SigningInfos (QuerySigningInfosRequest) returns (QuerySigningInfosResponse) { } + rpc SigningInfos (QuerySigningInfosRequest) returns (QuerySigningInfosResponse) {} } // QueryParametersRequest is the request type for the Query/Parameters RPC method -message QueryParamsRequest{ } +message QueryParamsRequest{} // QueryParametersResponse is the response type for the Query/Parameters RPC method message QueryParamsResponse{ diff --git a/x/slashing/keeper/grpc_query.go b/x/slashing/keeper/grpc_query.go index e62796091bb6..c1a5a3689e82 100644 --- a/x/slashing/keeper/grpc_query.go +++ b/x/slashing/keeper/grpc_query.go @@ -20,7 +20,7 @@ func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types ctx := sdk.UnwrapSDKContext(c) params := k.GetParams(ctx) - return &types.QueryParamsResponse{Params: ¶ms}, nil + return &types.QueryParamsResponse{Params: params}, nil } func (k Keeper) SigningInfo(c context.Context, req *types.QuerySigningInfoRequest) (*types.QuerySigningInfoResponse, error) { @@ -42,6 +42,6 @@ func (k Keeper) SigningInfos(c context.Context, req *types.QuerySigningInfosRequ return nil, status.Errorf(codes.InvalidArgument, "empty request") } - _ := sdk.UnwrapSDKContext(c) + _ = sdk.UnwrapSDKContext(c) return nil, nil } diff --git a/x/slashing/keeper/grpc_query_test.go b/x/slashing/keeper/grpc_query_test.go index 6ad9bd0ed226..ed90db39ad2c 100644 --- a/x/slashing/keeper/grpc_query_test.go +++ b/x/slashing/keeper/grpc_query_test.go @@ -22,8 +22,8 @@ func TestGRPCQueryParams(t *testing.T) { types.RegisterQueryServer(queryHelper, app.SlashingKeeper) queryClient := types.NewQueryClient(queryHelper) - params, err := queryClient.Params(gocontext.Background(), &types.QueryParamsRequest{}) + paramsResp, err := queryClient.Params(gocontext.Background(), &types.QueryParamsRequest{}) require.NoError(t, err) - require.Equal(t, keeper.TestParams(), params) + require.Equal(t, keeper.TestParams(), paramsResp.Params) } diff --git a/x/slashing/types/params.go b/x/slashing/types/params.go index 8499efdbac1f..07a77ed6652f 100644 --- a/x/slashing/types/params.go +++ b/x/slashing/types/params.go @@ -35,15 +35,6 @@ func ParamKeyTable() paramtypes.KeyTable { return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) } -// Params - used for initializing default parameter for slashing at genesis -type Params struct { - SignedBlocksWindow int64 `json:"signed_blocks_window" yaml:"signed_blocks_window"` - MinSignedPerWindow sdk.Dec `json:"min_signed_per_window" yaml:"min_signed_per_window"` - DowntimeJailDuration time.Duration `json:"downtime_jail_duration" yaml:"downtime_jail_duration"` - SlashFractionDoubleSign sdk.Dec `json:"slash_fraction_double_sign" yaml:"slash_fraction_double_sign"` - SlashFractionDowntime sdk.Dec `json:"slash_fraction_downtime" yaml:"slash_fraction_downtime"` -} - // NewParams creates a new Params object func NewParams( signedBlocksWindow int64, minSignedPerWindow sdk.Dec, downtimeJailDuration time.Duration, @@ -59,19 +50,6 @@ func NewParams( } } -// String implements the stringer interface for Params -func (p Params) String() string { - return fmt.Sprintf(`Slashing Params: - SignedBlocksWindow: %d - MinSignedPerWindow: %s - DowntimeJailDuration: %s - SlashFractionDoubleSign: %s - SlashFractionDowntime: %s`, - p.SignedBlocksWindow, p.MinSignedPerWindow, - p.DowntimeJailDuration, p.SlashFractionDoubleSign, - p.SlashFractionDowntime) -} - // ParamSetPairs - Implements params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ From 9dbd901e93905feaeb9a69c831f44e777b4a8b93 Mon Sep 17 00:00:00 2001 From: sahith-narahari Date: Sat, 4 Jul 2020 00:24:10 +0530 Subject: [PATCH 5/8] Add signing infos --- proto/cosmos/slashing/query.proto | 2 +- x/slashing/keeper/grpc_query.go | 26 ++++++++++++- x/slashing/types/query.pb.go | 64 +++++++++++++++---------------- 3 files changed, 57 insertions(+), 35 deletions(-) diff --git a/proto/cosmos/slashing/query.proto b/proto/cosmos/slashing/query.proto index 4927d53c9e0a..d9d3bac17f73 100644 --- a/proto/cosmos/slashing/query.proto +++ b/proto/cosmos/slashing/query.proto @@ -47,6 +47,6 @@ message QuerySigningInfosRequest{ // QuerySigningInfosResponse is the response type for the Query/SigningInfos RPC method message QuerySigningInfosResponse{ // info is the signing info of all validators - repeated cosmos.slashing.ValidatorSigningInfo info = 1; + repeated cosmos.slashing.ValidatorSigningInfo info = 1[(gogoproto.nullable)= false]; cosmos.query.PageResponse res =2; } diff --git a/x/slashing/keeper/grpc_query.go b/x/slashing/keeper/grpc_query.go index c1a5a3689e82..cb9f56a37b46 100644 --- a/x/slashing/keeper/grpc_query.go +++ b/x/slashing/keeper/grpc_query.go @@ -6,7 +6,9 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" "github.com/cosmos/cosmos-sdk/x/slashing/types" ) @@ -28,6 +30,10 @@ func (k Keeper) SigningInfo(c context.Context, req *types.QuerySigningInfoReques return nil, status.Errorf(codes.InvalidArgument, "empty request") } + if req.ConsAddress == nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) signingInfo, found := k.GetValidatorSigningInfo(ctx, req.ConsAddress) if !found { @@ -42,6 +48,22 @@ func (k Keeper) SigningInfos(c context.Context, req *types.QuerySigningInfosRequ return nil, status.Errorf(codes.InvalidArgument, "empty request") } - _ = sdk.UnwrapSDKContext(c) - return nil, nil + ctx := sdk.UnwrapSDKContext(c) + store := ctx.KVStore(k.storeKey) + var signInfos []types.ValidatorSigningInfo + + sigInfoStore := prefix.NewStore(store, types.ValidatorSigningInfoKeyPrefix) + res, err := query.Paginate(sigInfoStore, req.Req, func(key []byte, value []byte) error { + var info types.ValidatorSigningInfo + err := k.cdc.UnmarshalBinaryBare(value, &info) + if err != nil { + return err + } + signInfos = append(signInfos, info) + return nil + }) + if err != nil { + return nil, err + } + return &types.QuerySigningInfosResponse{Info: signInfos, Res: res}, nil } diff --git a/x/slashing/types/query.pb.go b/x/slashing/types/query.pb.go index 01dd677c0219..55fe4f3e3274 100644 --- a/x/slashing/types/query.pb.go +++ b/x/slashing/types/query.pb.go @@ -252,8 +252,8 @@ func (m *QuerySigningInfosRequest) GetReq() *query.PageRequest { // QuerySigningInfosResponse is the response type for the Query/SigningInfos RPC method type QuerySigningInfosResponse struct { // info is the signing info of all validators - Info []*ValidatorSigningInfo `protobuf:"bytes,1,rep,name=info,proto3" json:"info,omitempty"` - Res *query.PageResponse `protobuf:"bytes,2,opt,name=res,proto3" json:"res,omitempty"` + Info []ValidatorSigningInfo `protobuf:"bytes,1,rep,name=info,proto3" json:"info"` + Res *query.PageResponse `protobuf:"bytes,2,opt,name=res,proto3" json:"res,omitempty"` } func (m *QuerySigningInfosResponse) Reset() { *m = QuerySigningInfosResponse{} } @@ -289,7 +289,7 @@ func (m *QuerySigningInfosResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QuerySigningInfosResponse proto.InternalMessageInfo -func (m *QuerySigningInfosResponse) GetInfo() []*ValidatorSigningInfo { +func (m *QuerySigningInfosResponse) GetInfo() []ValidatorSigningInfo { if m != nil { return m.Info } @@ -315,36 +315,36 @@ func init() { func init() { proto.RegisterFile("cosmos/slashing/query.proto", fileDescriptor_12bf00fd6c136588) } var fileDescriptor_12bf00fd6c136588 = []byte{ - // 460 bytes of a gzipped FileDescriptorProto + // 461 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcd, 0x6e, 0xd3, 0x40, 0x10, 0xb6, 0xdb, 0x92, 0xc3, 0x26, 0x02, 0xb4, 0x54, 0x6a, 0x6a, 0x84, 0x8b, 0x0c, 0x48, 0xe5, - 0xa7, 0xb6, 0x14, 0xc4, 0x81, 0x23, 0xe1, 0x50, 0x21, 0x21, 0x51, 0x8c, 0xca, 0x81, 0x4b, 0xb4, - 0xb5, 0xb7, 0xdb, 0x55, 0x9d, 0x5d, 0xc7, 0xe3, 0x54, 0xe4, 0xce, 0x03, 0xf0, 0x22, 0xbc, 0x47, - 0x8e, 0x39, 0x72, 0x8a, 0x50, 0xf2, 0x16, 0x9c, 0x90, 0x77, 0xd7, 0x89, 0x89, 0xa3, 0x34, 0x27, - 0x8f, 0x67, 0xbe, 0xf9, 0xbe, 0x6f, 0x76, 0x67, 0xd1, 0xc3, 0x48, 0x42, 0x5f, 0x42, 0x00, 0x09, - 0x81, 0x2b, 0x2e, 0x58, 0x30, 0x18, 0xd2, 0x6c, 0xe4, 0xa7, 0x99, 0xcc, 0x25, 0xbe, 0xa7, 0x8b, - 0x7e, 0x59, 0x74, 0x1e, 0x19, 0xb4, 0x02, 0x05, 0x29, 0x61, 0x5c, 0x90, 0x9c, 0x4b, 0xa1, 0xf1, - 0xce, 0x3e, 0x93, 0x4c, 0xaa, 0x30, 0x28, 0x22, 0x93, 0x75, 0x57, 0x25, 0xca, 0x40, 0xd7, 0xbd, - 0x7d, 0x84, 0x3f, 0x17, 0x7c, 0x67, 0x24, 0x23, 0x7d, 0x08, 0xe9, 0x60, 0x48, 0x21, 0xf7, 0x3e, - 0xa2, 0x07, 0xff, 0x65, 0x21, 0x95, 0x02, 0x28, 0x7e, 0x83, 0x1a, 0xa9, 0xca, 0xb4, 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 0x52, 0xf9, 0xf7, 0x4e, 0xeb, 0x62, 0xe5, 0x45, 0xe2, 0x97, 0x68, 0x37, + 0xa3, 0x03, 0xc3, 0x7f, 0x58, 0xf2, 0xeb, 0x31, 0x9f, 0x11, 0x46, 0x0d, 0x2e, 0x2c, 0x50, 0xde, + 0x0f, 0x1b, 0x1d, 0xae, 0x61, 0x32, 0xbe, 0xdf, 0xa2, 0x3d, 0xe3, 0x75, 0x77, 0x6b, 0xaf, 0x66, + 0x10, 0xaa, 0x10, 0xbf, 0x2a, 0xbc, 0x40, 0x7b, 0x47, 0x79, 0x71, 0xd6, 0x79, 0xd1, 0x4a, 0x85, + 0x19, 0xe8, 0xfc, 0xda, 0x41, 0x77, 0x94, 0x19, 0x7c, 0x8e, 0x1a, 0x7a, 0xac, 0xf8, 0x49, 0x4d, + 0xb4, 0xbe, 0x3b, 0xce, 0xd3, 0xcd, 0x20, 0xad, 0xe1, 0x59, 0x38, 0x46, 0xcd, 0x8a, 0x53, 0x7c, + 0xbc, 0xbe, 0xac, 0xbe, 0x33, 0xce, 0xf3, 0x2d, 0x90, 0x0b, 0x15, 0x86, 0x5a, 0xd5, 0xdb, 0xc4, + 0xb7, 0x17, 0x2f, 0x1a, 0x79, 0xb1, 0x0d, 0xb4, 0x14, 0xea, 0x9e, 0x8e, 0x67, 0xae, 0x3d, 0x99, + 0xb9, 0xf6, 0x9f, 0x99, 0x6b, 0xff, 0x9c, 0xbb, 0xd6, 0x64, 0xee, 0x5a, 0xbf, 0xe7, 0xae, 0xf5, + 0xed, 0x64, 0xe3, 0x26, 0x7f, 0x5f, 0x3e, 0x4d, 0xb5, 0xd4, 0x17, 0x0d, 0xf5, 0x30, 0x5f, 0xff, + 0x0b, 0x00, 0x00, 0xff, 0xff, 0x6d, 0x8d, 0x13, 0x66, 0x1d, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1267,7 +1267,7 @@ func (m *QuerySigningInfosResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Info = append(m.Info, &ValidatorSigningInfo{}) + m.Info = append(m.Info, ValidatorSigningInfo{}) if err := m.Info[len(m.Info)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } From 7f713a856889b37dec1a99f53ba5a8b45e4f3269 Mon Sep 17 00:00:00 2001 From: sahith-narahari Date: Sun, 5 Jul 2020 16:11:29 +0530 Subject: [PATCH 6/8] Update query test --- x/slashing/keeper/grpc_query_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/slashing/keeper/grpc_query_test.go b/x/slashing/keeper/grpc_query_test.go index ed90db39ad2c..a257eb8d5be6 100644 --- a/x/slashing/keeper/grpc_query_test.go +++ b/x/slashing/keeper/grpc_query_test.go @@ -18,7 +18,7 @@ func TestGRPCQueryParams(t *testing.T) { ctx := app.BaseApp.NewContext(false, abci.Header{}) app.SlashingKeeper.SetParams(ctx, keeper.TestParams()) - queryHelper := baseapp.NewQueryServerTestHelper(ctx) + queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry()) types.RegisterQueryServer(queryHelper, app.SlashingKeeper) queryClient := types.NewQueryClient(queryHelper) From 312ec400ba873718e92b65acb7bc3a34a1b02a20 Mon Sep 17 00:00:00 2001 From: sahith-narahari Date: Tue, 7 Jul 2020 02:03:56 +0530 Subject: [PATCH 7/8] Use suite for grpc tests --- proto/cosmos/slashing/query.proto | 6 +-- x/slashing/keeper/grpc_query_test.go | 68 ++++++++++++++++++++++++++-- x/slashing/types/query.pb.go | 8 ++-- x/upgrade/types/query.pb.go | 10 ++-- 4 files changed, 75 insertions(+), 17 deletions(-) diff --git a/proto/cosmos/slashing/query.proto b/proto/cosmos/slashing/query.proto index d9d3bac17f73..eb7ea2413d31 100644 --- a/proto/cosmos/slashing/query.proto +++ b/proto/cosmos/slashing/query.proto @@ -9,7 +9,7 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/slashing/types"; // Query provides defines the gRPC querier service service Query { - // Parameters queries the parameters of slashing module + // Params queries the parameters of slashing module rpc Params (QueryParamsRequest) returns (QueryParamsResponse){} // SigningInfo queries the signing info of given cons address @@ -19,10 +19,10 @@ service Query { rpc SigningInfos (QuerySigningInfosRequest) returns (QuerySigningInfosResponse) {} } -// QueryParametersRequest is the request type for the Query/Parameters RPC method +// QueryParamsRequest is the request type for the Query/Parameters RPC method message QueryParamsRequest{} -// QueryParametersResponse is the response type for the Query/Parameters RPC method +// QueryParamsResponse is the response type for the Query/Parameters RPC method message QueryParamsResponse{ cosmos.slashing.Params params = 1[(gogoproto.nullable) = false]; } diff --git a/x/slashing/keeper/grpc_query_test.go b/x/slashing/keeper/grpc_query_test.go index a257eb8d5be6..7497284b4b79 100644 --- a/x/slashing/keeper/grpc_query_test.go +++ b/x/slashing/keeper/grpc_query_test.go @@ -3,27 +3,85 @@ package keeper_test import ( gocontext "context" "testing" + "time" - "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/slashing/keeper" "github.com/cosmos/cosmos-sdk/x/slashing/types" ) -func TestGRPCQueryParams(t *testing.T) { +type SlashingTestSuite struct { + suite.Suite + + app *simapp.SimApp + ctx sdk.Context + queryClient types.QueryClient + addrDels []sdk.AccAddress +} + +func (suite *SlashingTestSuite) SetupTest() { app := simapp.Setup(false) ctx := app.BaseApp.NewContext(false, abci.Header{}) + + app.AccountKeeper.SetParams(ctx, authtypes.DefaultParams()) + app.BankKeeper.SetSendEnabled(ctx, true) app.SlashingKeeper.SetParams(ctx, keeper.TestParams()) + addrDels := simapp.AddTestAddrsIncremental(app, ctx, 2, sdk.TokensFromConsensusPower(200)) + + info1 := types.NewValidatorSigningInfo(sdk.ConsAddress(addrDels[0]), int64(4), int64(3), + time.Unix(2, 0), false, int64(10)) + info2 := types.NewValidatorSigningInfo(sdk.ConsAddress(addrDels[1]), int64(5), int64(4), + time.Unix(2, 0), false, int64(10)) + app.SlashingKeeper.SetValidatorSigningInfo(ctx, sdk.ConsAddress(addrDels[0]), info1) + app.SlashingKeeper.SetValidatorSigningInfo(ctx, sdk.ConsAddress(addrDels[1]), info2) + + suite.app = app + suite.ctx = ctx + suite.addrDels = addrDels + queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry()) types.RegisterQueryServer(queryHelper, app.SlashingKeeper) queryClient := types.NewQueryClient(queryHelper) - paramsResp, err := queryClient.Params(gocontext.Background(), &types.QueryParamsRequest{}) - require.NoError(t, err) + suite.queryClient = queryClient +} + +func (suite *SlashingTestSuite) TestGRPCQueryParams() { + queryClient := suite.queryClient + var paramsResp, err = queryClient.Params(gocontext.Background(), nil) + suite.Error(err) + suite.Nil(paramsResp) + + paramsResp, err = queryClient.Params(gocontext.Background(), &types.QueryParamsRequest{}) + + suite.NoError(err) + suite.Equal(keeper.TestParams(), paramsResp.Params) +} + +func (suite *SlashingTestSuite) TestGRPCSigningInfo() { + queryClient := suite.queryClient + + infoResp, err := queryClient.SigningInfo(gocontext.Background(), &types.QuerySigningInfoRequest{ConsAddress: nil}) + suite.Error(err) + suite.Nil(infoResp) + + consAddr := sdk.ConsAddress(suite.addrDels[0]) + info, found := suite.app.SlashingKeeper.GetValidatorSigningInfo(suite.ctx, consAddr) + suite.True(found) + + infoResp, err = queryClient.SigningInfo(gocontext.Background(), + &types.QuerySigningInfoRequest{ConsAddress: consAddr}) + suite.NoError(err) + suite.Equal(&info, infoResp.ValSigningInfo) +} - require.Equal(t, keeper.TestParams(), paramsResp.Params) +func TestSlashingTestSuite(t *testing.T) { + suite.Run(t, new(SlashingTestSuite)) } diff --git a/x/slashing/types/query.pb.go b/x/slashing/types/query.pb.go index 55fe4f3e3274..c1539c6322e9 100644 --- a/x/slashing/types/query.pb.go +++ b/x/slashing/types/query.pb.go @@ -30,7 +30,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// QueryParametersRequest is the request type for the Query/Parameters RPC method +// QueryParamsRequest is the request type for the Query/Parameters RPC method type QueryParamsRequest struct { } @@ -67,7 +67,7 @@ func (m *QueryParamsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo -// QueryParametersResponse is the response type for the Query/Parameters RPC method +// QueryParamsResponse is the response type for the Query/Parameters RPC method type QueryParamsResponse struct { Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } @@ -359,7 +359,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // Parameters queries the parameters of slashing module + // Params queries the parameters of slashing module Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // SigningInfo queries the signing info of given cons address SigningInfo(ctx context.Context, in *QuerySigningInfoRequest, opts ...grpc.CallOption) (*QuerySigningInfoResponse, error) @@ -404,7 +404,7 @@ func (c *queryClient) SigningInfos(ctx context.Context, in *QuerySigningInfosReq // QueryServer is the server API for Query service. type QueryServer interface { - // Parameters queries the parameters of slashing module + // Params queries the parameters of slashing module Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // SigningInfo queries the signing info of given cons address SigningInfo(context.Context, *QuerySigningInfoRequest) (*QuerySigningInfoResponse, error) diff --git a/x/upgrade/types/query.pb.go b/x/upgrade/types/query.pb.go index 5494897faecb..6c1218611e73 100644 --- a/x/upgrade/types/query.pb.go +++ b/x/upgrade/types/query.pb.go @@ -66,7 +66,7 @@ var xxx_messageInfo_QueryCurrentPlanRequest proto.InternalMessageInfo // QueryCurrentPlanResponse is the response type for the Query/CurrentPlan RPC method type QueryCurrentPlanResponse struct { - // plan is the current plan + // plan is the current upgrade plan Plan *Plan `protobuf:"bytes,1,opt,name=plan,proto3" json:"plan,omitempty"` } @@ -245,9 +245,9 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // CurrentPlan queries the current plan + // CurrentPlan queries the current upgrade plan CurrentPlan(ctx context.Context, in *QueryCurrentPlanRequest, opts ...grpc.CallOption) (*QueryCurrentPlanResponse, error) - // AppliedPlan queries a previously applied plan by its name + // AppliedPlan queries a previously applied upgrade plan by its name AppliedPlan(ctx context.Context, in *QueryAppliedPlanRequest, opts ...grpc.CallOption) (*QueryAppliedPlanResponse, error) } @@ -279,9 +279,9 @@ func (c *queryClient) AppliedPlan(ctx context.Context, in *QueryAppliedPlanReque // QueryServer is the server API for Query service. type QueryServer interface { - // CurrentPlan queries the current plan + // CurrentPlan queries the current upgrade plan CurrentPlan(context.Context, *QueryCurrentPlanRequest) (*QueryCurrentPlanResponse, error) - // AppliedPlan queries a previously applied plan by its name + // AppliedPlan queries a previously applied upgrade plan by its name AppliedPlan(context.Context, *QueryAppliedPlanRequest) (*QueryAppliedPlanResponse, error) } From 60a0bce4b797a0eb5de35290d00a839c45de5a73 Mon Sep 17 00:00:00 2001 From: sahith-narahari Date: Tue, 7 Jul 2020 02:32:51 +0530 Subject: [PATCH 8/8] Update godoc --- proto/cosmos/slashing/query.proto | 2 +- x/slashing/keeper/grpc_query.go | 2 +- x/slashing/keeper/grpc_query_test.go | 36 ++++++++--- x/slashing/types/query.pb.go | 91 +++++++++++++--------------- 4 files changed, 73 insertions(+), 58 deletions(-) diff --git a/proto/cosmos/slashing/query.proto b/proto/cosmos/slashing/query.proto index eb7ea2413d31..450892d680ac 100644 --- a/proto/cosmos/slashing/query.proto +++ b/proto/cosmos/slashing/query.proto @@ -36,7 +36,7 @@ message QuerySigningInfoRequest{ // QuerySigningInfoResponse is the response type for the Query/SigningInfo RPC method message QuerySigningInfoResponse{ // val_signing_info is the signing info of requested val cons address - cosmos.slashing.ValidatorSigningInfo val_signing_info = 1; + cosmos.slashing.ValidatorSigningInfo val_signing_info = 1[(gogoproto.nullable)= false]; } // QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC method diff --git a/x/slashing/keeper/grpc_query.go b/x/slashing/keeper/grpc_query.go index cb9f56a37b46..b4462976c742 100644 --- a/x/slashing/keeper/grpc_query.go +++ b/x/slashing/keeper/grpc_query.go @@ -40,7 +40,7 @@ func (k Keeper) SigningInfo(c context.Context, req *types.QuerySigningInfoReques return nil, status.Errorf(codes.NotFound, "SigningInfo not found for validator %s", req.ConsAddress) } - return &types.QuerySigningInfoResponse{ValSigningInfo: &signingInfo}, nil + return &types.QuerySigningInfoResponse{ValSigningInfo: signingInfo}, nil } func (k Keeper) SigningInfos(c context.Context, req *types.QuerySigningInfosRequest) (*types.QuerySigningInfosResponse, error) { diff --git a/x/slashing/keeper/grpc_query_test.go b/x/slashing/keeper/grpc_query_test.go index 7497284b4b79..bfa002f074de 100644 --- a/x/slashing/keeper/grpc_query_test.go +++ b/x/slashing/keeper/grpc_query_test.go @@ -11,6 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/slashing/keeper" "github.com/cosmos/cosmos-sdk/x/slashing/types" @@ -39,6 +40,7 @@ func (suite *SlashingTestSuite) SetupTest() { time.Unix(2, 0), false, int64(10)) info2 := types.NewValidatorSigningInfo(sdk.ConsAddress(addrDels[1]), int64(5), int64(4), time.Unix(2, 0), false, int64(10)) + app.SlashingKeeper.SetValidatorSigningInfo(ctx, sdk.ConsAddress(addrDels[0]), info1) app.SlashingKeeper.SetValidatorSigningInfo(ctx, sdk.ConsAddress(addrDels[1]), info2) @@ -49,17 +51,12 @@ func (suite *SlashingTestSuite) SetupTest() { queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry()) types.RegisterQueryServer(queryHelper, app.SlashingKeeper) queryClient := types.NewQueryClient(queryHelper) - suite.queryClient = queryClient } func (suite *SlashingTestSuite) TestGRPCQueryParams() { queryClient := suite.queryClient - var paramsResp, err = queryClient.Params(gocontext.Background(), nil) - suite.Error(err) - suite.Nil(paramsResp) - - paramsResp, err = queryClient.Params(gocontext.Background(), &types.QueryParamsRequest{}) + paramsResp, err := queryClient.Params(gocontext.Background(), &types.QueryParamsRequest{}) suite.NoError(err) suite.Equal(keeper.TestParams(), paramsResp.Params) @@ -79,7 +76,32 @@ func (suite *SlashingTestSuite) TestGRPCSigningInfo() { infoResp, err = queryClient.SigningInfo(gocontext.Background(), &types.QuerySigningInfoRequest{ConsAddress: consAddr}) suite.NoError(err) - suite.Equal(&info, infoResp.ValSigningInfo) + suite.Equal(info, infoResp.ValSigningInfo) +} + +func (suite *SlashingTestSuite) TestGRPCSigningInfos() { + queryClient := suite.queryClient + + var signingInfos []types.ValidatorSigningInfo + + suite.app.SlashingKeeper.IterateValidatorSigningInfos(suite.ctx, func(consAddr sdk.ConsAddress, info types.ValidatorSigningInfo) (stop bool) { + signingInfos = append(signingInfos, info) + return false + }) + + // verify all values are returned without pagination + var infoResp, err = queryClient.SigningInfos(gocontext.Background(), + &types.QuerySigningInfosRequest{Req: nil}) + suite.NoError(err) + suite.Equal(signingInfos, infoResp.Info) + + infoResp, err = queryClient.SigningInfos(gocontext.Background(), + &types.QuerySigningInfosRequest{Req: &query.PageRequest{Limit: 1, CountTotal: true}}) + suite.NoError(err) + suite.Len(infoResp.Info, 1) + suite.Equal(signingInfos[0], infoResp.Info[0]) + suite.NotNil(infoResp.Res.NextKey) + suite.Equal(uint64(2), infoResp.Res.Total) } func TestSlashingTestSuite(t *testing.T) { diff --git a/x/slashing/types/query.pb.go b/x/slashing/types/query.pb.go index c1539c6322e9..cf912465f5b7 100644 --- a/x/slashing/types/query.pb.go +++ b/x/slashing/types/query.pb.go @@ -161,7 +161,7 @@ func (m *QuerySigningInfoRequest) GetConsAddress() github_com_cosmos_cosmos_sdk_ // QuerySigningInfoResponse is the response type for the Query/SigningInfo RPC method type QuerySigningInfoResponse struct { // val_signing_info is the signing info of requested val cons address - ValSigningInfo *ValidatorSigningInfo `protobuf:"bytes,1,opt,name=val_signing_info,json=valSigningInfo,proto3" json:"val_signing_info,omitempty"` + ValSigningInfo ValidatorSigningInfo `protobuf:"bytes,1,opt,name=val_signing_info,json=valSigningInfo,proto3" json:"val_signing_info"` } func (m *QuerySigningInfoResponse) Reset() { *m = QuerySigningInfoResponse{} } @@ -197,11 +197,11 @@ func (m *QuerySigningInfoResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QuerySigningInfoResponse proto.InternalMessageInfo -func (m *QuerySigningInfoResponse) GetValSigningInfo() *ValidatorSigningInfo { +func (m *QuerySigningInfoResponse) GetValSigningInfo() ValidatorSigningInfo { if m != nil { return m.ValSigningInfo } - return nil + return ValidatorSigningInfo{} } // QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC method @@ -315,36 +315,36 @@ func init() { func init() { proto.RegisterFile("cosmos/slashing/query.proto", fileDescriptor_12bf00fd6c136588) } var fileDescriptor_12bf00fd6c136588 = []byte{ - // 461 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcd, 0x6e, 0xd3, 0x40, + // 460 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xcd, 0x6e, 0xd3, 0x40, 0x10, 0xb6, 0xdb, 0x92, 0xc3, 0x26, 0x02, 0xb4, 0x54, 0x6a, 0x6a, 0x84, 0x8b, 0x0c, 0x48, 0xe5, - 0xa7, 0xb6, 0x14, 0xc4, 0x19, 0x11, 0x0e, 0x15,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, 0xb1, 0x0d, 0xb4, 0x14, 0xea, 0x9e, 0x8e, 0x67, 0xae, 0x3d, 0x99, - 0xb9, 0xf6, 0x9f, 0x99, 0x6b, 0xff, 0x9c, 0xbb, 0xd6, 0x64, 0xee, 0x5a, 0xbf, 0xe7, 0xae, 0xf5, - 0xed, 0x64, 0xe3, 0x26, 0x7f, 0x5f, 0x3e, 0x4d, 0xb5, 0xd4, 0x17, 0x0d, 0xf5, 0x30, 0x5f, 0xff, - 0x0b, 0x00, 0x00, 0xff, 0xff, 0x6d, 0x8d, 0x13, 0x66, 0x1d, 0x04, 0x00, 0x00, + 0xa7, 0xb6, 0x14, 0xc4, 0x19, 0x11, 0x0e, 0x15, 0x12, 0x87, 0x62, 0x14, 0x0e, 0x5c, 0xa2, 0xad, + 0xbd, 0xdd, 0xae, 0x70, 0x76, 0x6d, 0x8f, 0x53, 0xd1, 0x57, 0xe0, 0xc4, 0x8b, 0xf0, 0x1e, 0x3d, + 0xe6, 0xc8, 0x29, 0x42, 0xc9, 0x5b, 0x70, 0x42, 0xde, 0x5d, 0x27, 0x26, 0x8e, 0x42, 0x38, 0x79, + 0x3c, 0xf3, 0xcd, 0x7c, 0xdf, 0xb7, 0x3b, 0x8b, 0xee, 0x47, 0x12, 0x46, 0x12, 0x02, 0x48, 0x08, + 0x5c, 0x72, 0xc1, 0x82, 0x6c, 0x4c, 0xf3, 0x6b, 0x3f, 0xcd, 0x65, 0x21, 0xf1, 0x1d, 0x5d, 0xf4, + 0xab, 0xa2, 0xf3, 0xc0, 0xa0, 0x15, 0x28, 0x48, 0x09, 0xe3, 0x82, 0x14, 0x5c, 0x0a, 0x8d, 0x77, + 0xf6, 0x99, 0x64, 0x52, 0x85, 0x41, 0x19, 0x99, 0xac, 0xbb, 0x4a, 0x51, 0x05, 0xba, 0xee, 0xed, + 0x23, 0xfc, 0xa1, 0x9c, 0x77, 0x46, 0x72, 0x32, 0x82, 0x90, 0x66, 0x63, 0x0a, 0x85, 0xf7, 0x1e,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xee, 0x8e, 0xd2, 0xe2, 0xac, 0xd3, 0xa2, 0x99, 0x4a, 0x31, + 0xd0, 0xfb, 0xb1, 0x83, 0x6e, 0x29, 0x31, 0x78, 0x80, 0x5a, 0xfa, 0x72, 0xf1, 0xa3, 0x06, 0x69, + 0x73, 0x83, 0x9c, 0xc7, 0x9b, 0x41, 0x9a, 0xc3, 0xb3, 0x70, 0x8c, 0xda, 0x35, 0xa5, 0xf8, 0x78, + 0x7d, 0x5b, 0x73, 0x73, 0x9c, 0xa7, 0x5b, 0x20, 0x17, 0x2c, 0x0c, 0x75, 0xea, 0xa7, 0x89, 0xff, + 0xdd, 0xbc, 0x30, 0xf2, 0x6c, 0x1b, 0x68, 0x45, 0xd4, 0x3f, 0xbd, 0x99, 0xb9, 0xf6, 0x64, 0xe6, + 0xda, 0xbf, 0x66, 0xae, 0xfd, 0x7d, 0xee, 0x5a, 0x93, 0xb9, 0x6b, 0xfd, 0x9c, 0xbb, 0xd6, 0xe7, + 0x93, 0x8d, 0xfb, 0xfc, 0x75, 0xf9, 0x40, 0xd5, 0x6a, 0x9f, 0xb7, 0xd4, 0xf3, 0x7c, 0xf9, 0x27, + 0x00, 0x00, 0xff, 0xff, 0x73, 0x48, 0x10, 0xb6, 0x23, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -611,18 +611,16 @@ func (m *QuerySigningInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l - if m.ValSigningInfo != nil { - { - size, err := m.ValSigningInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + { + size, err := m.ValSigningInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -760,10 +758,8 @@ func (m *QuerySigningInfoResponse) Size() (n int) { } var l int _ = l - if m.ValSigningInfo != nil { - l = m.ValSigningInfo.Size() - n += 1 + l + sovQuery(uint64(l)) - } + l = m.ValSigningInfo.Size() + n += 1 + l + sovQuery(uint64(l)) return n } @@ -1089,9 +1085,6 @@ func (m *QuerySigningInfoResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ValSigningInfo == nil { - m.ValSigningInfo = &ValidatorSigningInfo{} - } if err := m.ValSigningInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err }