From a0daec2d94a79e952a8f3b50e4ea5d246f22b463 Mon Sep 17 00:00:00 2001 From: SaReN Date: Tue, 7 Jul 2020 03:24:25 +0530 Subject: [PATCH] x/Slashing: gRPC query service (#6597) * Add grpc methods - slashing * Add slashing grpc queries * Add tests * Remove duplicate declarations * Add signing infos * Update query test * Use suite for grpc tests * Update godoc Co-authored-by: Alexander Bezobchuk Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- proto/cosmos/slashing/query.proto | 52 + proto/cosmos/slashing/slashing.proto | 23 + x/slashing/keeper/grpc_query.go | 69 ++ x/slashing/keeper/grpc_query_test.go | 109 ++ x/slashing/types/params.go | 22 - x/slashing/types/query.pb.go | 1411 ++++++++++++++++++++++++++ x/slashing/types/slashing.pb.go | 463 ++++++++- 7 files changed, 2096 insertions(+), 53 deletions(-) create mode 100644 proto/cosmos/slashing/query.proto create mode 100644 x/slashing/keeper/grpc_query.go create mode 100644 x/slashing/keeper/grpc_query_test.go 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 0000000000..450892d680 --- /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 { + // Params queries the parameters of slashing module + rpc Params (QueryParamsRequest) returns (QueryParamsResponse){} + + // 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) {} +} + +// QueryParamsRequest is the request type for the Query/Parameters RPC method +message QueryParamsRequest{} + +// QueryParamsResponse is the response type for the Query/Parameters RPC method +message QueryParamsResponse{ + cosmos.slashing.Params params = 1[(gogoproto.nullable) = false]; +} + +// 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[(gogoproto.nullable)= false]; +} + +// 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[(gogoproto.nullable)= false]; + cosmos.query.PageResponse res =2; +} diff --git a/proto/cosmos/slashing/slashing.proto b/proto/cosmos/slashing/slashing.proto index 6f546a7d19..f5ad699eb6 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/keeper/grpc_query.go b/x/slashing/keeper/grpc_query.go new file mode 100644 index 0000000000..b4462976c7 --- /dev/null +++ b/x/slashing/keeper/grpc_query.go @@ -0,0 +1,69 @@ +package keeper + +import ( + "context" + + "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" +) + +var _ types.QueryServer = Keeper{} + +func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(c) + params := k.GetParams(ctx) + + return &types.QueryParamsResponse{Params: params}, nil +} + +func (k Keeper) SigningInfo(c context.Context, req *types.QuerySigningInfoRequest) (*types.QuerySigningInfoResponse, error) { + if req == nil { + 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 { + 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) + 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/keeper/grpc_query_test.go b/x/slashing/keeper/grpc_query_test.go new file mode 100644 index 0000000000..bfa002f074 --- /dev/null +++ b/x/slashing/keeper/grpc_query_test.go @@ -0,0 +1,109 @@ +package keeper_test + +import ( + gocontext "context" + "testing" + "time" + + "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" + "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" +) + +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) + suite.queryClient = queryClient +} + +func (suite *SlashingTestSuite) TestGRPCQueryParams() { + queryClient := suite.queryClient + 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) +} + +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) { + suite.Run(t, new(SlashingTestSuite)) +} diff --git a/x/slashing/types/params.go b/x/slashing/types/params.go index c2fd844824..aa9cd559e7 100644 --- a/x/slashing/types/params.go +++ b/x/slashing/types/params.go @@ -34,15 +34,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, @@ -58,19 +49,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{ diff --git a/x/slashing/types/query.pb.go b/x/slashing/types/query.pb.go new file mode 100644 index 0000000000..cf912465f5 --- /dev/null +++ b/x/slashing/types/query.pb.go @@ -0,0 +1,1411 @@ +// 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 + +// QueryParamsRequest is the request type for the Query/Parameters RPC method +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_12bf00fd6c136588, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// 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"` +} + +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 *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// 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"` +} + +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 { + // 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"` +} + +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 ValidatorSigningInfo{} +} + +// 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 is the signing info of all validators + 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{} } +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((*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") + proto.RegisterType((*QuerySigningInfosResponse)(nil), "cosmos.slashing.QuerySigningInfosResponse") +} + +func init() { proto.RegisterFile("cosmos/slashing/query.proto", fileDescriptor_12bf00fd6c136588) } + +var fileDescriptor_12bf00fd6c136588 = []byte{ + // 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, 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, + 0xdd, 0xfb, 0x2b, 0x0b, 0xa9, 0x14, 0x40, 0xf1, 0x2b, 0xd4, 0x4a, 0x55, 0xa6, 0x6b, 0x3f, 0xb4, + 0x8f, 0xdb, 0xbd, 0x03, 0x7f, 0x45, 0xa3, 0xaf, 0x1b, 0xfa, 0x7b, 0x37, 0xd3, 0x23, 0x2b, 0x34, + 0x60, 0x2f, 0x45, 0x07, 0x6a, 0xda, 0x47, 0xce, 0x04, 0x17, 0xec, 0x9d, 0xb8, 0x90, 0x86, 0x08, + 0x0f, 0x50, 0x27, 0x92, 0x02, 0x86, 0x24, 0x8e, 0x73, 0x0a, 0x7a, 0x6e, 0xa7, 0xdf, 0xfb, 0x3d, + 0x3d, 0xf2, 0x19, 0x2f, 0x2e, 0xc7, 0xe7, 0x7e, 0x24, 0x47, 0x81, 0xf1, 0xa0, 0x3f, 0x27, 0x10, + 0x7f, 0x09, 0x8a, 0xeb, 0x94, 0x82, 0xff, 0x56, 0x0a, 0x78, 0xa3, 0x3b, 0xc3, 0x76, 0xb4, 0xfc, + 0xf1, 0x32, 0xd4, 0x6d, 0x32, 0x1a, 0x13, 0x03, 0x74, 0xf7, 0x8a, 0x24, 0x43, 0xd0, 0xa5, 0x21, + 0x17, 0x17,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0x23, 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 { + // 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) + // 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) 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 + } + 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 { + // 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) + // 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) 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") +} +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_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).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.slashing.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + 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: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "SigningInfo", + Handler: _Query_SigningInfo_Handler, + }, + { + MethodName: "SigningInfos", + Handler: _Query_SigningInfos_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/slashing/query.proto", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (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 + { + 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 *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (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 + 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 *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + 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 *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + 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 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 ffc106bfb1..784a6da3f3 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, 0x9f, 0x69, 0x62, 0x9f, 0x62, 0x07, 0xb5, 0x2b, 0x7f, 0x41, 0x47, 0xc6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x7a, 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, 0x46, 0xd4, 0xff, 0x25, 0x6f, 0xa4, 0x70, 0xb9, 0xe8, 0x13, 0x9f, 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 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