From 0eb0d77b12dfac8431a074ea2615c906a7d5cc3c Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Tue, 7 Jun 2022 21:41:00 +0800 Subject: [PATCH 01/16] init checkpointing module added checkpointing tx proto add query proto for checkpointing generated proto code wraps up the scaffolding of checkpointing --- .gitignore | 2 +- config.yml | 2 +- go.mod | 9 + proto/babylon/checkpointing/genesis.proto | 30 + proto/babylon/checkpointing/params.proto | 9 + proto/babylon/checkpointing/query.proto | 43 + proto/babylon/checkpointing/tx.proto | 24 + x/checkpointing/client/cli/query.go | 30 + x/checkpointing/client/cli/query_params.go | 34 + x/checkpointing/client/cli/tx.go | 34 + x/checkpointing/client/testutil/cli_test.go | 1 + x/checkpointing/client/testutil/suite.go | 1 + x/checkpointing/exported/exported.go | 1 + x/checkpointing/genesis.go | 21 + x/checkpointing/handler.go | 23 + x/checkpointing/keeper/genesis.go | 1 + x/checkpointing/keeper/grpc_query.go | 12 + x/checkpointing/keeper/grpc_query_params.go | 19 + x/checkpointing/keeper/hooks.go | 1 + x/checkpointing/keeper/invariants.go | 1 + x/checkpointing/keeper/keeper.go | 33 + x/checkpointing/keeper/msg_server.go | 23 + x/checkpointing/keeper/params.go | 16 + x/checkpointing/keeper/querier.go | 1 + x/checkpointing/module.go | 173 ++++ x/checkpointing/module_simulation.go | 59 ++ x/checkpointing/simulation/genesis.go | 1 + x/checkpointing/simulation/operations.go | 1 + x/checkpointing/simulation/simap.go | 15 + x/checkpointing/spec/01_state.md | 0 x/checkpointing/spec/02_keepers.md | 0 x/checkpointing/spec/03_messages.md | 0 x/checkpointing/spec/04_events.md | 0 x/checkpointing/spec/05_params.md | 0 x/checkpointing/spec/README.md | 0 x/checkpointing/types/codec.go | 25 + x/checkpointing/types/errors.go | 4 + x/checkpointing/types/events.go | 1 + x/checkpointing/types/expected_keepers.go | 18 + x/checkpointing/types/genesis.go | 18 + x/checkpointing/types/genesis.pb.go | 1024 +++++++++++++++++++ x/checkpointing/types/keys.go | 22 + x/checkpointing/types/msgs.go | 29 + x/checkpointing/types/params.go | 39 + x/checkpointing/types/params.pb.go | 266 +++++ x/checkpointing/types/query.pb.go | 955 +++++++++++++++++ x/checkpointing/types/query.pb.gw.go | 153 +++ x/checkpointing/types/tx.pb.go | 530 ++++++++++ 48 files changed, 3702 insertions(+), 2 deletions(-) create mode 100644 proto/babylon/checkpointing/genesis.proto create mode 100644 proto/babylon/checkpointing/params.proto create mode 100644 proto/babylon/checkpointing/query.proto create mode 100644 proto/babylon/checkpointing/tx.proto create mode 100644 x/checkpointing/client/cli/query.go create mode 100644 x/checkpointing/client/cli/query_params.go create mode 100644 x/checkpointing/client/cli/tx.go create mode 100644 x/checkpointing/client/testutil/cli_test.go create mode 100644 x/checkpointing/client/testutil/suite.go create mode 100644 x/checkpointing/exported/exported.go create mode 100644 x/checkpointing/genesis.go create mode 100644 x/checkpointing/handler.go create mode 100644 x/checkpointing/keeper/genesis.go create mode 100644 x/checkpointing/keeper/grpc_query.go create mode 100644 x/checkpointing/keeper/grpc_query_params.go create mode 100644 x/checkpointing/keeper/hooks.go create mode 100644 x/checkpointing/keeper/invariants.go create mode 100644 x/checkpointing/keeper/keeper.go create mode 100644 x/checkpointing/keeper/msg_server.go create mode 100644 x/checkpointing/keeper/params.go create mode 100644 x/checkpointing/keeper/querier.go create mode 100644 x/checkpointing/module.go create mode 100644 x/checkpointing/module_simulation.go create mode 100644 x/checkpointing/simulation/genesis.go create mode 100644 x/checkpointing/simulation/operations.go create mode 100644 x/checkpointing/simulation/simap.go create mode 100644 x/checkpointing/spec/01_state.md create mode 100644 x/checkpointing/spec/02_keepers.md create mode 100644 x/checkpointing/spec/03_messages.md create mode 100644 x/checkpointing/spec/04_events.md create mode 100644 x/checkpointing/spec/05_params.md create mode 100644 x/checkpointing/spec/README.md create mode 100644 x/checkpointing/types/codec.go create mode 100644 x/checkpointing/types/errors.go create mode 100644 x/checkpointing/types/events.go create mode 100644 x/checkpointing/types/expected_keepers.go create mode 100644 x/checkpointing/types/genesis.go create mode 100644 x/checkpointing/types/genesis.pb.go create mode 100644 x/checkpointing/types/keys.go create mode 100644 x/checkpointing/types/msgs.go create mode 100644 x/checkpointing/types/params.go create mode 100644 x/checkpointing/types/params.pb.go create mode 100644 x/checkpointing/types/query.pb.go create mode 100644 x/checkpointing/types/query.pb.gw.go create mode 100644 x/checkpointing/types/tx.pb.go diff --git a/.gitignore b/.gitignore index 8efe555d2..6fc0a9570 100644 --- a/.gitignore +++ b/.gitignore @@ -202,4 +202,4 @@ $RECYCLE.BIN/ /scripts/local/ /x/incentives/keeper/babylon_testing/ tools-stamp -/tests/localbabylon/.babylond/* \ No newline at end of file +/tests/localbabylon/.babylond/* diff --git a/config.yml b/config.yml index b71e9e208..a3274c794 100644 --- a/config.yml +++ b/config.yml @@ -7,4 +7,4 @@ accounts: coins: ["500token"] validator: name: alice - staked: "100000000stake" \ No newline at end of file + staked: "100000000stake" diff --git a/go.mod b/go.mod index 885d98ef2..84b1fb515 100644 --- a/go.mod +++ b/go.mod @@ -21,6 +21,15 @@ require ( gopkg.in/yaml.v2 v2.4.0 ) +require ( + github.com/gogo/protobuf v1.3.3 + github.com/golang/protobuf v1.5.2 + github.com/grpc-ecosystem/grpc-gateway v1.16.0 + google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd + google.golang.org/grpc v1.46.2 + google.golang.org/protobuf v1.28.0 +) + require ( filippo.io/edwards25519 v1.0.0-beta.2 // indirect github.com/99designs/keyring v1.1.6 // indirect diff --git a/proto/babylon/checkpointing/genesis.proto b/proto/babylon/checkpointing/genesis.proto new file mode 100644 index 000000000..d451763f8 --- /dev/null +++ b/proto/babylon/checkpointing/genesis.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +package babylon.checkpointing.v1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; +import "babylon/checkpointing/params.proto"; + +option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; + +// GenesisState defines the checkpointing module's genesis state. +message GenesisState { Params params = 1 [ (gogoproto.nullable) = false ]; } + +// RawCheckpoint wraps the multi sig with other meta data. +// This can go on a separate file. +message RawCheckpoint { + int64 epoch_num = 1; + bytes last_commit_hash = 2; + bytes bitmap = 3; + bytes multi_sig = 4; +} + +// BlsSig wraps the bls sig with other meta data. +// This can go on a separate file. +message BlsSig { + int64 epoch_num = 1; + bytes last_commit_hash = 2; + bytes bls_sig = 3; + google.protobuf.Timestamp time = 4; + string signer = 5; +} \ No newline at end of file diff --git a/proto/babylon/checkpointing/params.proto b/proto/babylon/checkpointing/params.proto new file mode 100644 index 000000000..64de397eb --- /dev/null +++ b/proto/babylon/checkpointing/params.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; +package babylon.checkpointing.v1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; + +// Params defines the parameters for the module. +message Params { option (gogoproto.goproto_stringer) = false; } \ No newline at end of file diff --git a/proto/babylon/checkpointing/query.proto b/proto/babylon/checkpointing/query.proto new file mode 100644 index 000000000..85c8ad11b --- /dev/null +++ b/proto/babylon/checkpointing/query.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; +package babylon.checkpointing.v1; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "babylon/checkpointing/params.proto"; +import "babylon/checkpointing/genesis.proto"; + +option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; + +// Query defines the gRPC querier service. +service Query { + // RawCheckpoints queries a list of checkpoints from a range of epochs. + rpc RawCheckpoints(QueryRawCheckpointsRequest) + returns (QueryRawCheckpointsResponse); + + // Parameters queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/babylonchain/babylon/checkpointing/params"; + } +} + +// QueryRawCheckpointsRequest is the request type for the Query/RawCheckpoints +// RPC method. +message QueryRawCheckpointsRequest { + int64 bottom_epoch = 1; + int64 top_epoch = 2; +} + +// QeuryRawCheckpointsResponse is the response type for the Query/RawCheckpoints +// RPC method. +message QueryRawCheckpointsResponse { + repeated RawCheckpoint raw_checkpoints = 1; +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/babylon/checkpointing/tx.proto b/proto/babylon/checkpointing/tx.proto new file mode 100644 index 000000000..c16e84a60 --- /dev/null +++ b/proto/babylon/checkpointing/tx.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; +package babylon.checkpointing.v1; + +import "gogoproto/gogo.proto"; +import "babylon/checkpointing/genesis.proto"; + +option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; + +// Msg defines the checkpointing Msg service. +service Msg { + rpc CollectBlsSig(MsgCollectBlsSig) returns (MsgCollectBlsSigResponse); +} + +// MsgCollectBlsSig defines a message to collect a bls signature from a +// validator +message MsgCollectBlsSig { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + BlsSig bls_sig = 1; +} + +// MsgCollectBlsSigResponse defines the MsgCollectBlsSig response type. +message MsgCollectBlsSigResponse {} \ No newline at end of file diff --git a/x/checkpointing/client/cli/query.go b/x/checkpointing/client/cli/query.go new file mode 100644 index 000000000..7c794b947 --- /dev/null +++ b/x/checkpointing/client/cli/query.go @@ -0,0 +1,30 @@ +package cli + +import ( + "fmt" + // "strings" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + // "github.com/cosmos/cosmos-sdk/client/flags" + // sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/babylonchain/babylon/x/checkpointing/types" +) + +// GetQueryCmd returns the cli query commands for this module +func GetQueryCmd(queryRoute string) *cobra.Command { + // Group headeroracle queries under a subcommand + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdQueryParams()) + + return cmd +} diff --git a/x/checkpointing/client/cli/query_params.go b/x/checkpointing/client/cli/query_params.go new file mode 100644 index 000000000..64405737f --- /dev/null +++ b/x/checkpointing/client/cli/query_params.go @@ -0,0 +1,34 @@ +package cli + +import ( + "context" + + "github.com/babylonchain/babylon/x/checkpointing/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" +) + +func CmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "shows the parameters of the module", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/checkpointing/client/cli/tx.go b/x/checkpointing/client/cli/tx.go new file mode 100644 index 000000000..7d145e801 --- /dev/null +++ b/x/checkpointing/client/cli/tx.go @@ -0,0 +1,34 @@ +package cli + +import ( + "fmt" + "time" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + // "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/babylonchain/babylon/x/checkpointing/types" +) + +var ( + DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) +) + +const ( + flagPacketTimeoutTimestamp = "packet-timeout-timestamp" + listSeparator = "," +) + +// GetTxCmd returns the transaction commands for this module +func GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + return cmd +} diff --git a/x/checkpointing/client/testutil/cli_test.go b/x/checkpointing/client/testutil/cli_test.go new file mode 100644 index 000000000..110b2e6a7 --- /dev/null +++ b/x/checkpointing/client/testutil/cli_test.go @@ -0,0 +1 @@ +package testutil diff --git a/x/checkpointing/client/testutil/suite.go b/x/checkpointing/client/testutil/suite.go new file mode 100644 index 000000000..110b2e6a7 --- /dev/null +++ b/x/checkpointing/client/testutil/suite.go @@ -0,0 +1 @@ +package testutil diff --git a/x/checkpointing/exported/exported.go b/x/checkpointing/exported/exported.go new file mode 100644 index 000000000..eabd8aa3d --- /dev/null +++ b/x/checkpointing/exported/exported.go @@ -0,0 +1 @@ +package exported diff --git a/x/checkpointing/genesis.go b/x/checkpointing/genesis.go new file mode 100644 index 000000000..87894ea3b --- /dev/null +++ b/x/checkpointing/genesis.go @@ -0,0 +1,21 @@ +package checkpointing + +import ( + "github.com/babylonchain/babylon/x/checkpointing/keeper" + "github.com/babylonchain/babylon/x/checkpointing/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// InitGenesis initializes the capability module's state from a provided genesis +// state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + k.SetParams(ctx, genState.Params) +} + +// ExportGenesis returns the capability module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) + + return genesis +} diff --git a/x/checkpointing/handler.go b/x/checkpointing/handler.go new file mode 100644 index 000000000..a572129ec --- /dev/null +++ b/x/checkpointing/handler.go @@ -0,0 +1,23 @@ +package checkpointing + +import ( + "fmt" + + "github.com/babylonchain/babylon/x/checkpointing/keeper" + "github.com/babylonchain/babylon/x/checkpointing/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +// NewHandler ... +func NewHandler(k keeper.Keeper) sdk.Handler { + return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { + ctx = ctx.WithEventManager(sdk.NewEventManager()) + + switch msg := msg.(type) { + default: + errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) + return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) + } + } +} diff --git a/x/checkpointing/keeper/genesis.go b/x/checkpointing/keeper/genesis.go new file mode 100644 index 000000000..b55569d4a --- /dev/null +++ b/x/checkpointing/keeper/genesis.go @@ -0,0 +1 @@ +package keeper diff --git a/x/checkpointing/keeper/grpc_query.go b/x/checkpointing/keeper/grpc_query.go new file mode 100644 index 000000000..23227beec --- /dev/null +++ b/x/checkpointing/keeper/grpc_query.go @@ -0,0 +1,12 @@ +package keeper + +import ( + "context" + "github.com/babylonchain/babylon/x/checkpointing/types" +) + +var _ types.QueryServer = Keeper{} + +func (k Keeper) RawCheckpoints(c context.Context, req *types.QueryRawCheckpointsRequest) (*types.QueryRawCheckpointsResponse, error) { + panic("TODO: implement this") +} diff --git a/x/checkpointing/keeper/grpc_query_params.go b/x/checkpointing/keeper/grpc_query_params.go new file mode 100644 index 000000000..973af637a --- /dev/null +++ b/x/checkpointing/keeper/grpc_query_params.go @@ -0,0 +1,19 @@ +package keeper + +import ( + "context" + + "github.com/babylonchain/babylon/x/checkpointing/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil +} diff --git a/x/checkpointing/keeper/hooks.go b/x/checkpointing/keeper/hooks.go new file mode 100644 index 000000000..b55569d4a --- /dev/null +++ b/x/checkpointing/keeper/hooks.go @@ -0,0 +1 @@ +package keeper diff --git a/x/checkpointing/keeper/invariants.go b/x/checkpointing/keeper/invariants.go new file mode 100644 index 000000000..b55569d4a --- /dev/null +++ b/x/checkpointing/keeper/invariants.go @@ -0,0 +1 @@ +package keeper diff --git a/x/checkpointing/keeper/keeper.go b/x/checkpointing/keeper/keeper.go new file mode 100644 index 000000000..bd1ce28ca --- /dev/null +++ b/x/checkpointing/keeper/keeper.go @@ -0,0 +1,33 @@ +package keeper + +import ( + "github.com/babylonchain/babylon/x/checkpointing/types" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +type Keeper struct { + cdc codec.BinaryCodec + storeKey sdk.StoreKey + memKey sdk.StoreKey + paramstore paramtypes.Subspace +} + +func NewKeeper( + cdc codec.BinaryCodec, + storeKey, + memKey sdk.StoreKey, + ps paramtypes.Subspace, +) *Keeper { + // set KeyTable if it has not already been set + if !ps.HasKeyTable() { + ps = ps.WithKeyTable(types.ParamKeyTable()) + } + return &Keeper{ + cdc: cdc, + storeKey: storeKey, + memKey: memKey, + paramstore: ps, + } +} diff --git a/x/checkpointing/keeper/msg_server.go b/x/checkpointing/keeper/msg_server.go new file mode 100644 index 000000000..7e387f374 --- /dev/null +++ b/x/checkpointing/keeper/msg_server.go @@ -0,0 +1,23 @@ +package keeper + +import ( + "context" + "github.com/babylonchain/babylon/x/checkpointing/types" +) + +type msgServer struct { + k Keeper +} + +func (m msgServer) CollectBlsSig(ctx context.Context, header *types.MsgCollectBlsSig) (*types.MsgCollectBlsSigResponse, error) { + //TODO implement me + panic("implement me") +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/x/checkpointing/keeper/params.go b/x/checkpointing/keeper/params.go new file mode 100644 index 000000000..489692a8b --- /dev/null +++ b/x/checkpointing/keeper/params.go @@ -0,0 +1,16 @@ +package keeper + +import ( + "github.com/babylonchain/babylon/x/checkpointing/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx sdk.Context) types.Params { + return types.NewParams() +} + +// SetParams set the params +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + k.paramstore.SetParamSet(ctx, ¶ms) +} diff --git a/x/checkpointing/keeper/querier.go b/x/checkpointing/keeper/querier.go new file mode 100644 index 000000000..b55569d4a --- /dev/null +++ b/x/checkpointing/keeper/querier.go @@ -0,0 +1 @@ +package keeper diff --git a/x/checkpointing/module.go b/x/checkpointing/module.go new file mode 100644 index 000000000..dea99254c --- /dev/null +++ b/x/checkpointing/module.go @@ -0,0 +1,173 @@ +package checkpointing + +import ( + "encoding/json" + "fmt" + + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + abci "github.com/tendermint/tendermint/abci/types" + + "github.com/babylonchain/babylon/x/checkpointing/client/cli" + "github.com/babylonchain/babylon/x/checkpointing/keeper" + "github.com/babylonchain/babylon/x/checkpointing/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface for the capability module. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the capability module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(cdc) +} + +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(cdc) +} + +// RegisterInterfaces registers the module's interface types +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns the capability module's default genesis state. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis performs genesis state validation for the capability module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterRESTRoutes registers the capability module's REST service handlers. +func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { +} + +// GetTxCmd returns the capability module's root tx command. +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the capability module's root query command. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd(types.StoreKey) +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface for the capability module. +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +// Name returns the capability module's name. +func (am AppModule) Name() string { + return am.AppModuleBasic.Name() +} + +// Route returns the capability module's message routing key. +func (am AppModule) Route() sdk.Route { + return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) +} + +// QuerierRoute returns the capability module's query routing key. +func (AppModule) QuerierRoute() string { return types.QuerierRoute } + +// LegacyQuerierHandler returns the capability module's Querier. +func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { + return nil +} + +// RegisterServices registers a GRPC query service to respond to the +// module-specific GRPC queries. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +// RegisterInvariants registers the capability module's invariants. +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the capability module's genesis initialization It returns +// no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + InitGenesis(ctx, am.keeper, genState) + + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion implements ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 2 } + +// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. +func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} + +// EndBlock executes all ABCI EndBlock logic respective to the capability module. It +// returns no validator updates. +func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return []abci.ValidatorUpdate{} +} diff --git a/x/checkpointing/module_simulation.go b/x/checkpointing/module_simulation.go new file mode 100644 index 000000000..932686a2a --- /dev/null +++ b/x/checkpointing/module_simulation.go @@ -0,0 +1,59 @@ +package checkpointing + +import ( + "math/rand" + + "github.com/babylonchain/babylon/testutil/sample" + checkpointingsimulation "github.com/babylonchain/babylon/x/checkpointing/simulation" + "github.com/babylonchain/babylon/x/checkpointing/types" + "github.com/cosmos/cosmos-sdk/baseapp" + simappparams "github.com/cosmos/cosmos-sdk/simapp/params" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" +) + +// avoid unused import issue +var ( + _ = sample.AccAddress + _ = checkpointingsimulation.FindAccount + _ = simappparams.StakePerAccount + _ = simulation.MsgEntryKind + _ = baseapp.Paramspace +) + +const () + +// GenerateGenesisState creates a randomized GenState of the module +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + accs := make([]string, len(simState.Accounts)) + for i, acc := range simState.Accounts { + accs[i] = acc.Address.String() + } + headeroracleGenesis := types.GenesisState{ + Params: types.DefaultParams(), + } + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&headeroracleGenesis) +} + +// ProposalContents doesn't return any content functions for governance proposals +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { + return nil +} + +// RandomizedParams creates randomized param changes for the simulator +func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { + + return []simtypes.ParamChange{} +} + +// RegisterStoreDecoder registers a decoder +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} + +// WeightedOperations returns the all the gov module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + operations := make([]simtypes.WeightedOperation, 0) + + return operations +} diff --git a/x/checkpointing/simulation/genesis.go b/x/checkpointing/simulation/genesis.go new file mode 100644 index 000000000..02eddda2b --- /dev/null +++ b/x/checkpointing/simulation/genesis.go @@ -0,0 +1 @@ +package simulation diff --git a/x/checkpointing/simulation/operations.go b/x/checkpointing/simulation/operations.go new file mode 100644 index 000000000..02eddda2b --- /dev/null +++ b/x/checkpointing/simulation/operations.go @@ -0,0 +1 @@ +package simulation diff --git a/x/checkpointing/simulation/simap.go b/x/checkpointing/simulation/simap.go new file mode 100644 index 000000000..92c437c0d --- /dev/null +++ b/x/checkpointing/simulation/simap.go @@ -0,0 +1,15 @@ +package simulation + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +// FindAccount find a specific address from an account list +func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { + creator, err := sdk.AccAddressFromBech32(address) + if err != nil { + panic(err) + } + return simtypes.FindAccount(accs, creator) +} diff --git a/x/checkpointing/spec/01_state.md b/x/checkpointing/spec/01_state.md new file mode 100644 index 000000000..e69de29bb diff --git a/x/checkpointing/spec/02_keepers.md b/x/checkpointing/spec/02_keepers.md new file mode 100644 index 000000000..e69de29bb diff --git a/x/checkpointing/spec/03_messages.md b/x/checkpointing/spec/03_messages.md new file mode 100644 index 000000000..e69de29bb diff --git a/x/checkpointing/spec/04_events.md b/x/checkpointing/spec/04_events.md new file mode 100644 index 000000000..e69de29bb diff --git a/x/checkpointing/spec/05_params.md b/x/checkpointing/spec/05_params.md new file mode 100644 index 000000000..e69de29bb diff --git a/x/checkpointing/spec/README.md b/x/checkpointing/spec/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/x/checkpointing/types/codec.go b/x/checkpointing/types/codec.go new file mode 100644 index 000000000..d08bdb183 --- /dev/null +++ b/x/checkpointing/types/codec.go @@ -0,0 +1,25 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +func RegisterCodec(cdc *codec.LegacyAmino) { +} + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + + // Register messages + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgCollectBlsSig{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + Amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) +) diff --git a/x/checkpointing/types/errors.go b/x/checkpointing/types/errors.go new file mode 100644 index 000000000..389c8e5ed --- /dev/null +++ b/x/checkpointing/types/errors.go @@ -0,0 +1,4 @@ +package types + +// x/checkpointing module sentinel errors +var () diff --git a/x/checkpointing/types/events.go b/x/checkpointing/types/events.go new file mode 100644 index 000000000..ab1254f4c --- /dev/null +++ b/x/checkpointing/types/events.go @@ -0,0 +1 @@ +package types diff --git a/x/checkpointing/types/expected_keepers.go b/x/checkpointing/types/expected_keepers.go new file mode 100644 index 000000000..6aa6e9778 --- /dev/null +++ b/x/checkpointing/types/expected_keepers.go @@ -0,0 +1,18 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/types" +) + +// AccountKeeper defines the expected account keeper used for simulations (noalias) +type AccountKeeper interface { + GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI + // Methods imported from account should be defined here +} + +// BankKeeper defines the expected interface needed to retrieve account balances. +type BankKeeper interface { + SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + // Methods imported from bank should be defined here +} diff --git a/x/checkpointing/types/genesis.go b/x/checkpointing/types/genesis.go new file mode 100644 index 000000000..a6cdfe807 --- /dev/null +++ b/x/checkpointing/types/genesis.go @@ -0,0 +1,18 @@ +package types + +// DefaultIndex is the default capability global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default Capability genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + + return gs.Params.Validate() +} diff --git a/x/checkpointing/types/genesis.pb.go b/x/checkpointing/types/genesis.pb.go new file mode 100644 index 000000000..63e2899b1 --- /dev/null +++ b/x/checkpointing/types/genesis.pb.go @@ -0,0 +1,1024 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: babylon/checkpointing/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + 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 + +// GenesisState defines the checkpointing module's genesis state. +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_cdd0fb065da1de51, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// RawCheckpoint wraps the multi sig with other meta data. +// This can go on a separate file. +type RawCheckpoint struct { + EpochNum int64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` + LastCommitHash []byte `protobuf:"bytes,2,opt,name=last_commit_hash,json=lastCommitHash,proto3" json:"last_commit_hash,omitempty"` + Bitmap []byte `protobuf:"bytes,3,opt,name=bitmap,proto3" json:"bitmap,omitempty"` + MultiSig []byte `protobuf:"bytes,4,opt,name=multi_sig,json=multiSig,proto3" json:"multi_sig,omitempty"` +} + +func (m *RawCheckpoint) Reset() { *m = RawCheckpoint{} } +func (m *RawCheckpoint) String() string { return proto.CompactTextString(m) } +func (*RawCheckpoint) ProtoMessage() {} +func (*RawCheckpoint) Descriptor() ([]byte, []int) { + return fileDescriptor_cdd0fb065da1de51, []int{1} +} +func (m *RawCheckpoint) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RawCheckpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RawCheckpoint.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 *RawCheckpoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_RawCheckpoint.Merge(m, src) +} +func (m *RawCheckpoint) XXX_Size() int { + return m.Size() +} +func (m *RawCheckpoint) XXX_DiscardUnknown() { + xxx_messageInfo_RawCheckpoint.DiscardUnknown(m) +} + +var xxx_messageInfo_RawCheckpoint proto.InternalMessageInfo + +func (m *RawCheckpoint) GetEpochNum() int64 { + if m != nil { + return m.EpochNum + } + return 0 +} + +func (m *RawCheckpoint) GetLastCommitHash() []byte { + if m != nil { + return m.LastCommitHash + } + return nil +} + +func (m *RawCheckpoint) GetBitmap() []byte { + if m != nil { + return m.Bitmap + } + return nil +} + +func (m *RawCheckpoint) GetMultiSig() []byte { + if m != nil { + return m.MultiSig + } + return nil +} + +// BlsSig wraps the bls sig with other meta data. +// This can go on a separate file. +type BlsSig struct { + EpochNum int64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` + LastCommitHash []byte `protobuf:"bytes,2,opt,name=last_commit_hash,json=lastCommitHash,proto3" json:"last_commit_hash,omitempty"` + BlsSig []byte `protobuf:"bytes,3,opt,name=bls_sig,json=blsSig,proto3" json:"bls_sig,omitempty"` + Time *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=time,proto3" json:"time,omitempty"` + Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"` +} + +func (m *BlsSig) Reset() { *m = BlsSig{} } +func (m *BlsSig) String() string { return proto.CompactTextString(m) } +func (*BlsSig) ProtoMessage() {} +func (*BlsSig) Descriptor() ([]byte, []int) { + return fileDescriptor_cdd0fb065da1de51, []int{2} +} +func (m *BlsSig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BlsSig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BlsSig.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 *BlsSig) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlsSig.Merge(m, src) +} +func (m *BlsSig) XXX_Size() int { + return m.Size() +} +func (m *BlsSig) XXX_DiscardUnknown() { + xxx_messageInfo_BlsSig.DiscardUnknown(m) +} + +var xxx_messageInfo_BlsSig proto.InternalMessageInfo + +func (m *BlsSig) GetEpochNum() int64 { + if m != nil { + return m.EpochNum + } + return 0 +} + +func (m *BlsSig) GetLastCommitHash() []byte { + if m != nil { + return m.LastCommitHash + } + return nil +} + +func (m *BlsSig) GetBlsSig() []byte { + if m != nil { + return m.BlsSig + } + return nil +} + +func (m *BlsSig) GetTime() *timestamppb.Timestamp { + if m != nil { + return m.Time + } + return nil +} + +func (m *BlsSig) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "babylon.checkpointing.v1.GenesisState") + proto.RegisterType((*RawCheckpoint)(nil), "babylon.checkpointing.v1.RawCheckpoint") + proto.RegisterType((*BlsSig)(nil), "babylon.checkpointing.v1.BlsSig") +} + +func init() { + proto.RegisterFile("babylon/checkpointing/genesis.proto", fileDescriptor_cdd0fb065da1de51) +} + +var fileDescriptor_cdd0fb065da1de51 = []byte{ + // 387 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x91, 0xc1, 0x4e, 0xa3, 0x40, + 0x1c, 0xc6, 0x99, 0x6d, 0x97, 0x6d, 0xa7, 0xdd, 0xcd, 0x86, 0x6c, 0x76, 0x49, 0x37, 0xa1, 0x04, + 0x2f, 0x9c, 0x86, 0x58, 0xe3, 0xd5, 0x43, 0x7b, 0xd0, 0x53, 0x35, 0xd4, 0x93, 0x17, 0x32, 0x90, + 0x71, 0x98, 0xc8, 0x30, 0xa4, 0x33, 0xa8, 0x7d, 0x06, 0x2f, 0x3e, 0x8a, 0x8f, 0xd1, 0x63, 0x8f, + 0x9e, 0x8c, 0x69, 0x5f, 0xc4, 0x30, 0x80, 0x89, 0x46, 0x6f, 0xde, 0xf8, 0xbe, 0xff, 0x8f, 0xff, + 0xff, 0x83, 0x0f, 0xee, 0xc5, 0x38, 0x5e, 0x65, 0x22, 0x0f, 0x92, 0x94, 0x24, 0x57, 0x85, 0x60, + 0xb9, 0x62, 0x39, 0x0d, 0x28, 0xc9, 0x89, 0x64, 0x12, 0x15, 0x4b, 0xa1, 0x84, 0x65, 0x37, 0x10, + 0x7a, 0x03, 0xa1, 0xeb, 0xfd, 0xd1, 0x1f, 0x2a, 0xa8, 0xd0, 0x50, 0x50, 0x3d, 0xd5, 0xfc, 0x68, + 0x4c, 0x85, 0xa0, 0x19, 0x09, 0xb4, 0x8a, 0xcb, 0xcb, 0x40, 0x31, 0x4e, 0xa4, 0xc2, 0xbc, 0x68, + 0x00, 0xef, 0xe3, 0xab, 0x05, 0x5e, 0x62, 0xde, 0x1c, 0xf5, 0xe6, 0x70, 0x78, 0x5c, 0xa7, 0x58, + 0x28, 0xac, 0x88, 0x75, 0x04, 0xcd, 0x7a, 0x6e, 0x03, 0x17, 0xf8, 0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1e, 0x34, 0xa5, 0x24, 0x29, 0x66, 0x79, 0x2b, 0x82, 0xdb, 0x77, 0x45, 0xab, 0x55, 0x41, + 0x64, 0x6c, 0xea, 0x08, 0x07, 0x2f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x6d, 0xd5, 0x94, 0xe4, 0x84, + 0x02, 0x00, 0x00, +} + +func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) 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 = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *RawCheckpoint) 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 *RawCheckpoint) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RawCheckpoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.MultiSig) > 0 { + i -= len(m.MultiSig) + copy(dAtA[i:], m.MultiSig) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.MultiSig))) + i-- + dAtA[i] = 0x22 + } + if len(m.Bitmap) > 0 { + i -= len(m.Bitmap) + copy(dAtA[i:], m.Bitmap) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Bitmap))) + i-- + dAtA[i] = 0x1a + } + if len(m.LastCommitHash) > 0 { + i -= len(m.LastCommitHash) + copy(dAtA[i:], m.LastCommitHash) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.LastCommitHash))) + i-- + dAtA[i] = 0x12 + } + if m.EpochNum != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.EpochNum)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *BlsSig) 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 *BlsSig) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlsSig) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x2a + } + if m.Time != nil { + { + size, err := m.Time.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if len(m.BlsSig) > 0 { + i -= len(m.BlsSig) + copy(dAtA[i:], m.BlsSig) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.BlsSig))) + i-- + dAtA[i] = 0x1a + } + if len(m.LastCommitHash) > 0 { + i -= len(m.LastCommitHash) + copy(dAtA[i:], m.LastCommitHash) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.LastCommitHash))) + i-- + dAtA[i] = 0x12 + } + if m.EpochNum != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.EpochNum)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func (m *RawCheckpoint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.EpochNum != 0 { + n += 1 + sovGenesis(uint64(m.EpochNum)) + } + l = len(m.LastCommitHash) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = len(m.Bitmap) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = len(m.MultiSig) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} + +func (m *BlsSig) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.EpochNum != 0 { + n += 1 + sovGenesis(uint64(m.EpochNum)) + } + l = len(m.LastCommitHash) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = len(m.BlsSig) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if m.Time != nil { + l = m.Time.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) 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 ErrIntOverflowGenesis + } + 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: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: 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 ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + 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 := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RawCheckpoint) 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 ErrIntOverflowGenesis + } + 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: RawCheckpoint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RawCheckpoint: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochNum", wireType) + } + m.EpochNum = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochNum |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastCommitHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LastCommitHash = append(m.LastCommitHash[:0], dAtA[iNdEx:postIndex]...) + if m.LastCommitHash == nil { + m.LastCommitHash = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bitmap", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bitmap = append(m.Bitmap[:0], dAtA[iNdEx:postIndex]...) + if m.Bitmap == nil { + m.Bitmap = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MultiSig", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MultiSig = append(m.MultiSig[:0], dAtA[iNdEx:postIndex]...) + if m.MultiSig == nil { + m.MultiSig = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BlsSig) 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 ErrIntOverflowGenesis + } + 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: BlsSig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlsSig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochNum", wireType) + } + m.EpochNum = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochNum |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastCommitHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LastCommitHash = append(m.LastCommitHash[:0], dAtA[iNdEx:postIndex]...) + if m.LastCommitHash == nil { + m.LastCommitHash = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlsSig", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlsSig = append(m.BlsSig[:0], dAtA[iNdEx:postIndex]...) + if m.BlsSig == nil { + m.BlsSig = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Time == nil { + m.Time = ×tamppb.Timestamp{} + } + if err := m.Time.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrIntOverflowGenesis + } + 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, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/checkpointing/types/keys.go b/x/checkpointing/types/keys.go new file mode 100644 index 000000000..2c4e576d4 --- /dev/null +++ b/x/checkpointing/types/keys.go @@ -0,0 +1,22 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "checkpointing" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // RouterKey is the message route for slashing + RouterKey = ModuleName + + // QuerierRoute defines the module's query routing key + QuerierRoute = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_checkpointing" +) + +func KeyPrefix(p string) []byte { + return []byte(p) +} diff --git a/x/checkpointing/types/msgs.go b/x/checkpointing/types/msgs.go new file mode 100644 index 000000000..9c3faf871 --- /dev/null +++ b/x/checkpointing/types/msgs.go @@ -0,0 +1,29 @@ +package types + +import sdk "github.com/cosmos/cosmos-sdk/types" + +var ( + // Ensure that MsgInsertHeader implements all functions of the Msg interface + _ sdk.Msg = (*MsgCollectBlsSig)(nil) +) + +func (m *MsgCollectBlsSig) ValidateBasic() error { + // This function validates stateless message elements + _, err := sdk.AccAddressFromBech32(m.BlsSig.Signer) + if err != nil { + return err + } + + // TODO: verify bls sig + + return nil +} + +func (m *MsgCollectBlsSig) GetSigners() []sdk.AccAddress { + signer, err := sdk.AccAddressFromBech32(m.BlsSig.Signer) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{signer} +} diff --git a/x/checkpointing/types/params.go b/x/checkpointing/types/params.go new file mode 100644 index 000000000..357196ad6 --- /dev/null +++ b/x/checkpointing/types/params.go @@ -0,0 +1,39 @@ +package types + +import ( + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "gopkg.in/yaml.v2" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams() +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{} +} + +// Validate validates the set of params +func (p Params) Validate() error { + return nil +} + +// String implements the Stringer interface. +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} diff --git a/x/checkpointing/types/params.pb.go b/x/checkpointing/types/params.pb.go new file mode 100644 index 000000000..4ede32150 --- /dev/null +++ b/x/checkpointing/types/params.pb.go @@ -0,0 +1,266 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: babylon/checkpointing/params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + 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 + +// Params defines the parameters for the module. +type Params struct { +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_3587fe7b22c0f5bb, []int{0} +} +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 init() { + proto.RegisterType((*Params)(nil), "babylon.checkpointing.v1.Params") +} + +func init() { + proto.RegisterFile("babylon/checkpointing/params.proto", fileDescriptor_3587fe7b22c0f5bb) +} + +var fileDescriptor_3587fe7b22c0f5bb = []byte{ + // 160 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4a, 0x4a, 0x4c, 0xaa, + 0xcc, 0xc9, 0xcf, 0xd3, 0x4f, 0xce, 0x48, 0x4d, 0xce, 0x2e, 0xc8, 0xcf, 0xcc, 0x2b, 0xc9, 0xcc, + 0x4b, 0xd7, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, + 0x80, 0xaa, 0xd1, 0x43, 0x51, 0xa3, 0x57, 0x66, 0x28, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, + 0xa4, 0x0f, 0x62, 0x41, 0xd4, 0x2b, 0xf1, 0x71, 0xb1, 0x05, 0x80, 0xf5, 0x5b, 0xb1, 0xcc, 0x58, + 0x20, 0xcf, 0xe0, 0xe4, 0x7f, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, + 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0xa6, + 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x50, 0x4b, 0x92, 0x33, 0x12, + 0x33, 0xf3, 0x60, 0x1c, 0xfd, 0x0a, 0x34, 0x77, 0x95, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, + 0xed, 0x31, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x15, 0x10, 0xfe, 0xa5, 0xbd, 0x00, 0x00, 0x00, +} + +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 + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +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 ErrIntOverflowParams + } + 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 { + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrIntOverflowParams + } + 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, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/checkpointing/types/query.pb.go b/x/checkpointing/types/query.pb.go new file mode 100644 index 000000000..66e7d79f4 --- /dev/null +++ b/x/checkpointing/types/query.pb.go @@ -0,0 +1,955 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: babylon/checkpointing/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + 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 + +// QueryRawCheckpointsRequest is the request type for the Query/RawCheckpoints +// RPC method. +type QueryRawCheckpointsRequest struct { + BottomEpoch int64 `protobuf:"varint,1,opt,name=bottom_epoch,json=bottomEpoch,proto3" json:"bottom_epoch,omitempty"` + TopEpoch int64 `protobuf:"varint,2,opt,name=top_epoch,json=topEpoch,proto3" json:"top_epoch,omitempty"` +} + +func (m *QueryRawCheckpointsRequest) Reset() { *m = QueryRawCheckpointsRequest{} } +func (m *QueryRawCheckpointsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRawCheckpointsRequest) ProtoMessage() {} +func (*QueryRawCheckpointsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a0fdb8f0f85bb51e, []int{0} +} +func (m *QueryRawCheckpointsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRawCheckpointsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRawCheckpointsRequest.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 *QueryRawCheckpointsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRawCheckpointsRequest.Merge(m, src) +} +func (m *QueryRawCheckpointsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryRawCheckpointsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRawCheckpointsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRawCheckpointsRequest proto.InternalMessageInfo + +func (m *QueryRawCheckpointsRequest) GetBottomEpoch() int64 { + if m != nil { + return m.BottomEpoch + } + return 0 +} + +func (m *QueryRawCheckpointsRequest) GetTopEpoch() int64 { + if m != nil { + return m.TopEpoch + } + return 0 +} + +// QeuryRawCheckpointsResponse is the response type for the Query/RawCheckpoints +// RPC method. +type QueryRawCheckpointsResponse struct { + RawCheckpoints []*RawCheckpoint `protobuf:"bytes,1,rep,name=raw_checkpoints,json=rawCheckpoints,proto3" json:"raw_checkpoints,omitempty"` +} + +func (m *QueryRawCheckpointsResponse) Reset() { *m = QueryRawCheckpointsResponse{} } +func (m *QueryRawCheckpointsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRawCheckpointsResponse) ProtoMessage() {} +func (*QueryRawCheckpointsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a0fdb8f0f85bb51e, []int{1} +} +func (m *QueryRawCheckpointsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRawCheckpointsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRawCheckpointsResponse.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 *QueryRawCheckpointsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRawCheckpointsResponse.Merge(m, src) +} +func (m *QueryRawCheckpointsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryRawCheckpointsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRawCheckpointsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRawCheckpointsResponse proto.InternalMessageInfo + +func (m *QueryRawCheckpointsResponse) GetRawCheckpoints() []*RawCheckpoint { + if m != nil { + return m.RawCheckpoints + } + return nil +} + +// QueryParamsRequest is request type for the Query/Params 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_a0fdb8f0f85bb51e, []int{2} +} +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 response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + 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_a0fdb8f0f85bb51e, []int{3} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*QueryRawCheckpointsRequest)(nil), "babylon.checkpointing.v1.QueryRawCheckpointsRequest") + proto.RegisterType((*QueryRawCheckpointsResponse)(nil), "babylon.checkpointing.v1.QueryRawCheckpointsResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "babylon.checkpointing.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "babylon.checkpointing.v1.QueryParamsResponse") +} + +func init() { proto.RegisterFile("babylon/checkpointing/query.proto", fileDescriptor_a0fdb8f0f85bb51e) } + +var fileDescriptor_a0fdb8f0f85bb51e = []byte{ + // 407 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xcf, 0x8b, 0xd3, 0x40, + 0x14, 0xc7, 0x93, 0x56, 0x8b, 0x4e, 0xa5, 0xc2, 0xd8, 0x43, 0x49, 0x25, 0xb6, 0xf1, 0x60, 0x91, + 0x9a, 0x60, 0xb4, 0x57, 0x0f, 0x15, 0xcf, 0xd6, 0x80, 0x17, 0x11, 0xca, 0x24, 0x0c, 0x49, 0xb0, + 0x9d, 0x37, 0xcd, 0x4c, 0xad, 0x3d, 0x78, 0xf1, 0x2f, 0x10, 0x3c, 0x79, 0xf5, 0xaf, 0xe9, 0xb1, + 0xe0, 0x65, 0x4f, 0xcb, 0xd2, 0xee, 0x1f, 0xb2, 0x74, 0x32, 0xbb, 0x4b, 0x96, 0x64, 0x7f, 0xdc, + 0x86, 0xf7, 0x3e, 0xef, 0xfb, 0x7d, 0xef, 0xcb, 0xa0, 0x7e, 0x48, 0xc2, 0xf5, 0x0c, 0x98, 0x17, + 0x25, 0x34, 0xfa, 0xc6, 0x21, 0x65, 0x32, 0x65, 0xb1, 0xb7, 0x58, 0xd2, 0x6c, 0xed, 0xf2, 0x0c, + 0x24, 0xe0, 0x8e, 0x46, 0xdc, 0x02, 0xe2, 0x7e, 0x7f, 0x6d, 0xb5, 0x63, 0x88, 0x41, 0x41, 0xde, + 0xe1, 0x95, 0xf3, 0xd6, 0xd3, 0x18, 0x20, 0x9e, 0x51, 0x8f, 0xf0, 0xd4, 0x23, 0x8c, 0x81, 0x24, + 0x32, 0x05, 0x26, 0x74, 0xd7, 0x29, 0x37, 0xe4, 0x24, 0x23, 0xf3, 0x73, 0xe6, 0x79, 0x39, 0x13, + 0x53, 0x46, 0x45, 0xaa, 0x21, 0xe7, 0x2b, 0xb2, 0x3e, 0x1d, 0xb6, 0x0c, 0xc8, 0xea, 0xfd, 0x05, + 0x26, 0x02, 0xba, 0x58, 0x52, 0x21, 0x71, 0x1f, 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 0x36, 0x8e, + 0xf6, 0xb6, 0xf1, 0x65, 0x14, 0xa7, 0x32, 0x59, 0x86, 0x6e, 0x04, 0xf3, 0x72, 0xbd, 0x1f, 0x57, + 0x14, 0xe5, 0x9a, 0x53, 0x11, 0x36, 0xd4, 0xc7, 0x7d, 0x73, 0x16, 0x00, 0x00, 0xff, 0xff, 0xd7, + 0x57, 0xdf, 0x4f, 0x74, 0x03, 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 { + // RawCheckpoints queries a list of checkpoints from a range of epochs. + RawCheckpoints(ctx context.Context, in *QueryRawCheckpointsRequest, opts ...grpc.CallOption) (*QueryRawCheckpointsResponse, error) + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) RawCheckpoints(ctx context.Context, in *QueryRawCheckpointsRequest, opts ...grpc.CallOption) (*QueryRawCheckpointsResponse, error) { + out := new(QueryRawCheckpointsResponse) + err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/RawCheckpoints", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // RawCheckpoints queries a list of checkpoints from a range of epochs. + RawCheckpoints(context.Context, *QueryRawCheckpointsRequest) (*QueryRawCheckpointsResponse, error) + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) RawCheckpoints(ctx context.Context, req *QueryRawCheckpointsRequest) (*QueryRawCheckpointsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RawCheckpoints not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_RawCheckpoints_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRawCheckpointsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RawCheckpoints(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/babylon.checkpointing.v1.Query/RawCheckpoints", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RawCheckpoints(ctx, req.(*QueryRawCheckpointsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +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: "/babylon.checkpointing.v1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "babylon.checkpointing.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RawCheckpoints", + Handler: _Query_RawCheckpoints_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "babylon/checkpointing/query.proto", +} + +func (m *QueryRawCheckpointsRequest) 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 *QueryRawCheckpointsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRawCheckpointsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TopEpoch != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.TopEpoch)) + i-- + dAtA[i] = 0x10 + } + if m.BottomEpoch != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BottomEpoch)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryRawCheckpointsResponse) 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 *QueryRawCheckpointsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRawCheckpointsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RawCheckpoints) > 0 { + for iNdEx := len(m.RawCheckpoints) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RawCheckpoints[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 (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryRawCheckpointsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BottomEpoch != 0 { + n += 1 + sovQuery(uint64(m.BottomEpoch)) + } + if m.TopEpoch != 0 { + n += 1 + sovQuery(uint64(m.TopEpoch)) + } + return n +} + +func (m *QueryRawCheckpointsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.RawCheckpoints) > 0 { + for _, e := range m.RawCheckpoints { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryRawCheckpointsRequest) 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: QueryRawCheckpointsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRawCheckpointsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BottomEpoch", wireType) + } + m.BottomEpoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BottomEpoch |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TopEpoch", wireType) + } + m.TopEpoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TopEpoch |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryRawCheckpointsResponse) 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: QueryRawCheckpointsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRawCheckpointsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RawCheckpoints", 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.RawCheckpoints = append(m.RawCheckpoints, &RawCheckpoint{}) + if err := m.RawCheckpoints[len(m.RawCheckpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + 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/checkpointing/types/query.pb.gw.go b/x/checkpointing/types/query.pb.gw.go new file mode 100644 index 000000000..3ac347dcc --- /dev/null +++ b/x/checkpointing/types/query.pb.gw.go @@ -0,0 +1,153 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: babylon/checkpointing/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylonchain", "babylon", "checkpointing", "params"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage +) diff --git a/x/checkpointing/types/tx.pb.go b/x/checkpointing/types/tx.pb.go new file mode 100644 index 000000000..c4c9d5bfa --- /dev/null +++ b/x/checkpointing/types/tx.pb.go @@ -0,0 +1,530 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: babylon/checkpointing/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "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 + +// MsgCollectBlsSig defines a message to collect a bls signature from a +// validator +type MsgCollectBlsSig struct { + BlsSig *BlsSig `protobuf:"bytes,1,opt,name=bls_sig,json=blsSig,proto3" json:"bls_sig,omitempty"` +} + +func (m *MsgCollectBlsSig) Reset() { *m = MsgCollectBlsSig{} } +func (m *MsgCollectBlsSig) String() string { return proto.CompactTextString(m) } +func (*MsgCollectBlsSig) ProtoMessage() {} +func (*MsgCollectBlsSig) Descriptor() ([]byte, []int) { + return fileDescriptor_24b023a97b92daa6, []int{0} +} +func (m *MsgCollectBlsSig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCollectBlsSig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCollectBlsSig.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 *MsgCollectBlsSig) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCollectBlsSig.Merge(m, src) +} +func (m *MsgCollectBlsSig) XXX_Size() int { + return m.Size() +} +func (m *MsgCollectBlsSig) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCollectBlsSig.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCollectBlsSig proto.InternalMessageInfo + +// MsgCollectBlsSigResponse defines the MsgCollectBlsSig response type. +type MsgCollectBlsSigResponse struct { +} + +func (m *MsgCollectBlsSigResponse) Reset() { *m = MsgCollectBlsSigResponse{} } +func (m *MsgCollectBlsSigResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCollectBlsSigResponse) ProtoMessage() {} +func (*MsgCollectBlsSigResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_24b023a97b92daa6, []int{1} +} +func (m *MsgCollectBlsSigResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCollectBlsSigResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCollectBlsSigResponse.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 *MsgCollectBlsSigResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCollectBlsSigResponse.Merge(m, src) +} +func (m *MsgCollectBlsSigResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCollectBlsSigResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCollectBlsSigResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCollectBlsSigResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCollectBlsSig)(nil), "babylon.checkpointing.v1.MsgCollectBlsSig") + proto.RegisterType((*MsgCollectBlsSigResponse)(nil), "babylon.checkpointing.v1.MsgCollectBlsSigResponse") +} + +func init() { proto.RegisterFile("babylon/checkpointing/tx.proto", fileDescriptor_24b023a97b92daa6) } + +var fileDescriptor_24b023a97b92daa6 = []byte{ + // 255 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0x4a, 0x4c, 0xaa, + 0xcc, 0xc9, 0xcf, 0xd3, 0x4f, 0xce, 0x48, 0x4d, 0xce, 0x2e, 0xc8, 0xcf, 0xcc, 0x2b, 0xc9, 0xcc, + 0x4b, 0xd7, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x80, 0xca, 0xeb, 0xa1, + 0xc8, 0xeb, 0x95, 0x19, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x15, 0xe9, 0x83, 0x58, 0x10, + 0xf5, 0x52, 0xca, 0xd8, 0xcd, 0x4b, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0x86, 0x28, 0x52, 0x0a, + 0xe7, 0x12, 0xf0, 0x2d, 0x4e, 0x77, 0xce, 0xcf, 0xc9, 0x49, 0x4d, 0x2e, 0x71, 0xca, 0x29, 0x0e, + 0xce, 0x4c, 0x17, 0xb2, 0xe4, 0x62, 0x4f, 0xca, 0x29, 0x8e, 0x2f, 0xce, 0x4c, 0x97, 0x60, 0x54, + 0x60, 0xd4, 0xe0, 0x36, 0x52, 0xd0, 0xc3, 0x65, 0xb5, 0x1e, 0x44, 0x4b, 0x10, 0x5b, 0x12, 0x98, + 0xb6, 0xe2, 0xe8, 0x58, 0x20, 0xcf, 0xf0, 0x62, 0x81, 0x3c, 0x83, 0x92, 0x14, 0x97, 0x04, 0xba, + 0xc1, 0x41, 0xa9, 0xc5, 0x05, 0xf9, 0x79, 0xc5, 0xa9, 0x46, 0x65, 0x5c, 0xcc, 0xbe, 0xc5, 0xe9, + 0x42, 0xf9, 0x5c, 0xbc, 0xa8, 0x16, 0x6b, 0xe1, 0xb6, 0x07, 0xdd, 0x2c, 0x29, 0x23, 0xe2, 0xd5, + 0xc2, 0xec, 0x75, 0xf2, 0x3f, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, + 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xd3, + 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0xa8, 0xb9, 0xc9, 0x19, 0x89, + 0x99, 0x79, 0x30, 0x8e, 0x7e, 0x05, 0x7a, 0xac, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x03, + 0xd1, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x37, 0xb8, 0x55, 0xc2, 0xbb, 0x01, 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 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + CollectBlsSig(ctx context.Context, in *MsgCollectBlsSig, opts ...grpc.CallOption) (*MsgCollectBlsSigResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CollectBlsSig(ctx context.Context, in *MsgCollectBlsSig, opts ...grpc.CallOption) (*MsgCollectBlsSigResponse, error) { + out := new(MsgCollectBlsSigResponse) + err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Msg/CollectBlsSig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + CollectBlsSig(context.Context, *MsgCollectBlsSig) (*MsgCollectBlsSigResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CollectBlsSig(ctx context.Context, req *MsgCollectBlsSig) (*MsgCollectBlsSigResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CollectBlsSig not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CollectBlsSig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCollectBlsSig) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CollectBlsSig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/babylon.checkpointing.v1.Msg/CollectBlsSig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CollectBlsSig(ctx, req.(*MsgCollectBlsSig)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "babylon.checkpointing.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CollectBlsSig", + Handler: _Msg_CollectBlsSig_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "babylon/checkpointing/tx.proto", +} + +func (m *MsgCollectBlsSig) 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 *MsgCollectBlsSig) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCollectBlsSig) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BlsSig != nil { + { + size, err := m.BlsSig.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCollectBlsSigResponse) 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 *MsgCollectBlsSigResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCollectBlsSigResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgCollectBlsSig) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BlsSig != nil { + l = m.BlsSig.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCollectBlsSigResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgCollectBlsSig) 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 ErrIntOverflowTx + } + 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: MsgCollectBlsSig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCollectBlsSig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlsSig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BlsSig == nil { + m.BlsSig = &BlsSig{} + } + if err := m.BlsSig.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCollectBlsSigResponse) 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 ErrIntOverflowTx + } + 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: MsgCollectBlsSigResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCollectBlsSigResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) From b943bfa6f032ec63e5e7c23c11310c10d3478e59 Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Sun, 12 Jun 2022 11:09:02 +0800 Subject: [PATCH 02/16] fixed comments and add endpoints for query --- go.mod | 3 +- proto/babylon/checkpointing/checkpoint.proto | 47 + proto/babylon/checkpointing/genesis.proto | 22 +- proto/babylon/checkpointing/params.proto | 2 +- proto/babylon/checkpointing/query.proto | 155 +- proto/babylon/checkpointing/tx.proto | 14 +- x/checkpointing/keeper/grpc_query.go | 12 - x/checkpointing/keeper/grpc_query_blssigs.go | 10 + .../keeper/grpc_query_checkpoint.go | 32 + x/checkpointing/keeper/msg_server.go | 2 +- x/checkpointing/types/checkpoint.pb.go | 929 +++++ x/checkpointing/types/codec.go | 2 +- x/checkpointing/types/errors.go | 2 +- x/checkpointing/types/genesis.pb.go | 731 +--- x/checkpointing/types/keys.go | 2 +- x/checkpointing/types/msgs.go | 10 +- x/checkpointing/types/query.pb.go | 3656 +++++++++++++++-- x/checkpointing/types/query.pb.gw.go | 677 ++- x/checkpointing/types/tx.pb.go | 146 +- 19 files changed, 5258 insertions(+), 1196 deletions(-) create mode 100644 proto/babylon/checkpointing/checkpoint.proto delete mode 100644 x/checkpointing/keeper/grpc_query.go create mode 100644 x/checkpointing/keeper/grpc_query_blssigs.go create mode 100644 x/checkpointing/keeper/grpc_query_checkpoint.go create mode 100644 x/checkpointing/types/checkpoint.pb.go diff --git a/go.mod b/go.mod index 84b1fb515..22008ea9d 100644 --- a/go.mod +++ b/go.mod @@ -25,9 +25,11 @@ require ( github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.2 github.com/grpc-ecosystem/grpc-gateway v1.16.0 + github.com/regen-network/cosmos-proto v0.3.1 google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd google.golang.org/grpc v1.46.2 google.golang.org/protobuf v1.28.0 + gopkg.in/yaml.v2 v2.4.0 ) require ( @@ -101,7 +103,6 @@ require ( github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect - github.com/regen-network/cosmos-proto v0.3.1 // indirect github.com/rs/cors v1.8.2 // indirect github.com/rs/zerolog v1.23.0 // indirect github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect diff --git a/proto/babylon/checkpointing/checkpoint.proto b/proto/babylon/checkpointing/checkpoint.proto new file mode 100644 index 000000000..fec2a7c38 --- /dev/null +++ b/proto/babylon/checkpointing/checkpoint.proto @@ -0,0 +1,47 @@ +syntax = "proto3"; +package babylon.checkpointing.v1; + +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; + +// RawCheckpoint wraps the multi sig with meta data. +message RawCheckpoint { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + // epoch_num defines the epoch number the raw checkpoint is for + int64 epoch_num = 1; + // last_commit_hash defines the 'LastCommitHash' that individual bls sigs are signed on + bytes last_commit_hash = 2; + // bitmap defines the bitmap that indicates the signers of the bls multi sig + bytes bitmap = 3; + // bls_multi_sig defines the multi sig that is aggregated from individual bls sigs + bytes bls_multi_sig = 4; + // Status defines the status of the raw checkpoint + enum Status { + // UNCHECKPOINTED indicates the checkpoint has not appeared on BTC + UNCHECKPOINTED = 0; + // CHECKPOINTED_NOT_CONFIRMED indicates the checkpoint has been checkpointed on BTC but has insufficent confirmation + CHECKPOINTED_NOT_CONFIRMED = 1; + // CONFIRMED indicates the checkpoint has sufficient confirmation depth on BTC + CONFIRMED = 2; + } +} + +// BlsSig wraps the bls sig with meta data. +message BlsSig { + // epoch_num defines the epoch number that the bls sig is signed on + int64 epoch_num = 1; + // last_commit_hash defines the 'LastCommitHash' that the bls sig is signed on + bytes last_commit_hash = 2; + // bls_sig defines the actual bls sig + bytes bls_sig = 3; + google.protobuf.Timestamp time = 4; + // can't find cosmos_proto.scalar when compiling + // string signer_address = 5 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // the signer_address defines the address of the signer + string signer_address = 5; +} diff --git a/proto/babylon/checkpointing/genesis.proto b/proto/babylon/checkpointing/genesis.proto index d451763f8..c7fece593 100644 --- a/proto/babylon/checkpointing/genesis.proto +++ b/proto/babylon/checkpointing/genesis.proto @@ -2,29 +2,9 @@ syntax = "proto3"; package babylon.checkpointing.v1; import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; import "babylon/checkpointing/params.proto"; option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; -// GenesisState defines the checkpointing module's genesis state. +// GenesisState defines the checkpoint.proto module's genesis state. message GenesisState { Params params = 1 [ (gogoproto.nullable) = false ]; } - -// RawCheckpoint wraps the multi sig with other meta data. -// This can go on a separate file. -message RawCheckpoint { - int64 epoch_num = 1; - bytes last_commit_hash = 2; - bytes bitmap = 3; - bytes multi_sig = 4; -} - -// BlsSig wraps the bls sig with other meta data. -// This can go on a separate file. -message BlsSig { - int64 epoch_num = 1; - bytes last_commit_hash = 2; - bytes bls_sig = 3; - google.protobuf.Timestamp time = 4; - string signer = 5; -} \ No newline at end of file diff --git a/proto/babylon/checkpointing/params.proto b/proto/babylon/checkpointing/params.proto index 64de397eb..15612d498 100644 --- a/proto/babylon/checkpointing/params.proto +++ b/proto/babylon/checkpointing/params.proto @@ -6,4 +6,4 @@ import "gogoproto/gogo.proto"; option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; // Params defines the parameters for the module. -message Params { option (gogoproto.goproto_stringer) = false; } \ No newline at end of file +message Params { option (gogoproto.goproto_stringer) = false; } diff --git a/proto/babylon/checkpointing/query.proto b/proto/babylon/checkpointing/query.proto index 85c8ad11b..9529bf758 100644 --- a/proto/babylon/checkpointing/query.proto +++ b/proto/babylon/checkpointing/query.proto @@ -1,36 +1,175 @@ syntax = "proto3"; package babylon.checkpointing.v1; +import "cosmos/base/query/v1beta1/pagination.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "babylon/checkpointing/params.proto"; -import "babylon/checkpointing/genesis.proto"; +import "babylon/checkpointing/checkpoint.proto"; option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; // Query defines the gRPC querier service. service Query { - // RawCheckpoints queries a list of checkpoints from a range of epochs. - rpc RawCheckpoints(QueryRawCheckpointsRequest) - returns (QueryRawCheckpointsResponse); + // RawCheckpoints queries a list of checkpoints starting from a given epoch number to the current epoch number. + rpc RawCheckpoints(QueryRawCheckpointsRequest) returns (QueryRawCheckpointsResponse) { + option (google.api.http).get = "/babylon/checkpointing/v1/raw_checkpoints/{from_epoch_num}"; + } + + // RawCheckpoint queries a checkpoints at a given epoch number. + rpc RawCheckpoint(QueryRawCheckpointRequest) returns (QueryRawCheckpointResponse) { + option (google.api.http).get = "/babylon/checkpointing/v1/raw_checkpoint/{epoch_num}"; + } + + // LatestCheckpoint queries the latest checkpoint. + rpc LatestCheckpoint(QueryLatestCheckpointRequest) returns (QueryLatestCheckpointResponse) { + option (google.api.http).get = "/babylon/checkpointing/v1/latest_checkpoint"; + } + + // UncheckpointedCheckpoints queries a list of checkpoints with the status of UNCHECKPOINTED. + rpc UncheckpointedCheckpoints(QueryUncheckpointedCheckpointsRequest) returns (QueryUncheckpointedCheckpointsResponse) { + option (google.api.http).get = "/babylon/checkpointing/v1/uncheckpointed_checkpoints"; + } + + // UnderconfirmedCheckpoints queries a list of checkpoints with the status of CHECKPOINTED_NOT_CONFIRMED. + rpc UnderconfirmedCheckpoints(QueryUnderconfirmedCheckpointsRequest) returns (QueryUnderconfirmedCheckpointsResponse) { + option (google.api.http).get = "/babylon/checkpointing/v1/underconfirmed_checkpoints"; + } + + // ConfirmedCheckpoints queries a list of checkpoints with the status of CONFIRMED. + rpc ConfirmedCheckpoints(QueryConfirmedCheckpointsRequest) returns (QueryConfirmedCheckpointsResponse) { + option (google.api.http).get = "/babylon/checkpointing/v1/confirmed_checkpoints"; + } + + // BlsSigs queries a list of bls sigs of the validators at a given epoch number. + rpc BlsSigs(QueryBlsSigsRequest) returns (QueryBlsSigsResponse) { + option (google.api.http).get = "/babylon/checkpointing/v1/bls_sigs/{epoch_num}"; + } // Parameters queries the parameters of the module. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/babylonchain/babylon/checkpointing/params"; + option (google.api.http).get = "/babylon/checkpointing/v1/params"; } } // QueryRawCheckpointsRequest is the request type for the Query/RawCheckpoints // RPC method. message QueryRawCheckpointsRequest { - int64 bottom_epoch = 1; - int64 top_epoch = 2; + // from_epoch defines the start epoch of the query, which is inclusive + int64 from_epoch_num = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// QeuryRawCheckpointsResponse is the response type for the Query/RawCheckpoints +// QueryRawCheckpointsResponse is the response type for the Query/RawCheckpoints // RPC method. message QueryRawCheckpointsResponse { repeated RawCheckpoint raw_checkpoints = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryRawCheckpointRequest is the request type for the Query/RawCheckpoint +// RPC method. +message QueryRawCheckpointRequest { + // epoch_num defines the epoch for the queried checkpoint + int64 epoch_num = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryRawCheckpointResponse is the response type for the Query/RawCheckpoint +// RPC method. +message QueryRawCheckpointResponse { + RawCheckpoint raw_checkpoint = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryLatestCheckpointRequest is the request type for the Query/LatestCheckpoint +// RPC method. +message QueryLatestCheckpointRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryLatestCheckpointResponse is the response type for the Query/LatestCheckpoint +// RPC method. +message QueryLatestCheckpointResponse { + RawCheckpoint latest_checkpoint = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryUncheckpointedCheckpointsRequest is the request type for the Query/UncheckpointedCheckpoints +// RPC method. +message QueryUncheckpointedCheckpointsRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryUncheckpointedCheckpointsResponse is the response type for the Query/UncheckpointedCheckpoints +// RPC method. +message QueryUncheckpointedCheckpointsResponse { + repeated RawCheckpoint uncheckpointed_checkpoint = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryUnderconfirmedCheckpointsRequest is the request type for the Query/UnderconfirmedCheckpoints +// RPC method. +message QueryUnderconfirmedCheckpointsRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryUnderconfirmedCheckpointsResponse is the response type for the Query/UnderconfirmedCheckpoints +// RPC method. +message QueryUnderconfirmedCheckpointsResponse { + repeated RawCheckpoint underconfirmed_checkpoint = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryConfirmedCheckpointsRequest is the request type for the Query/ConfirmedCheckpoints +// RPC method. +message QueryConfirmedCheckpointsRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryConfirmedCheckpointsResponse is the response type for the Query/ConfirmedCheckpoints +// RPC method. +message QueryConfirmedCheckpointsResponse { + repeated RawCheckpoint confirmed_checkpoint = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryBlsSigsRequest is the request type for the Query/BlsSigs +// RPC method. +message QueryBlsSigsRequest { + // epoch_num defines the epoch for the queried bls sigs + int64 epoch_num = 1; + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryBlsSigsResponse is the response type for the Query/BlsSigs +// RPC method. +message QueryBlsSigsResponse { + repeated BlsSig bls_sigs = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; } // QueryParamsRequest is request type for the Query/Params RPC method. diff --git a/proto/babylon/checkpointing/tx.proto b/proto/babylon/checkpointing/tx.proto index c16e84a60..681ac0236 100644 --- a/proto/babylon/checkpointing/tx.proto +++ b/proto/babylon/checkpointing/tx.proto @@ -2,23 +2,23 @@ syntax = "proto3"; package babylon.checkpointing.v1; import "gogoproto/gogo.proto"; -import "babylon/checkpointing/genesis.proto"; +import "babylon/checkpointing/checkpoint.proto"; option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; -// Msg defines the checkpointing Msg service. +// Msg defines the checkpoint.proto Msg service. service Msg { - rpc CollectBlsSig(MsgCollectBlsSig) returns (MsgCollectBlsSigResponse); + rpc AddBlsSig(MsgAddBlsSig) returns (MsgAddBlsSigResponse); } -// MsgCollectBlsSig defines a message to collect a bls signature from a +// MsgAddBlsSig defines a message to add a bls signature from a // validator -message MsgCollectBlsSig { +message MsgAddBlsSig { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; BlsSig bls_sig = 1; } -// MsgCollectBlsSigResponse defines the MsgCollectBlsSig response type. -message MsgCollectBlsSigResponse {} \ No newline at end of file +// MsgAddBlsSigResponse defines the MsgAddBlsSig response type. +message MsgAddBlsSigResponse {} diff --git a/x/checkpointing/keeper/grpc_query.go b/x/checkpointing/keeper/grpc_query.go deleted file mode 100644 index 23227beec..000000000 --- a/x/checkpointing/keeper/grpc_query.go +++ /dev/null @@ -1,12 +0,0 @@ -package keeper - -import ( - "context" - "github.com/babylonchain/babylon/x/checkpointing/types" -) - -var _ types.QueryServer = Keeper{} - -func (k Keeper) RawCheckpoints(c context.Context, req *types.QueryRawCheckpointsRequest) (*types.QueryRawCheckpointsResponse, error) { - panic("TODO: implement this") -} diff --git a/x/checkpointing/keeper/grpc_query_blssigs.go b/x/checkpointing/keeper/grpc_query_blssigs.go new file mode 100644 index 000000000..bcd7e46e5 --- /dev/null +++ b/x/checkpointing/keeper/grpc_query_blssigs.go @@ -0,0 +1,10 @@ +package keeper + +import ( + "context" + "github.com/babylonchain/babylon/x/checkpointing/types" +) + +func (k Keeper) BlsSigs(c context.Context, req *types.QueryBlsSigsRequest) (*types.QueryBlsSigsResponse, error) { + panic("TODO: implement this") +} diff --git a/x/checkpointing/keeper/grpc_query_checkpoint.go b/x/checkpointing/keeper/grpc_query_checkpoint.go new file mode 100644 index 000000000..a215c0078 --- /dev/null +++ b/x/checkpointing/keeper/grpc_query_checkpoint.go @@ -0,0 +1,32 @@ +package keeper + +import ( + "context" + "github.com/babylonchain/babylon/x/checkpointing/types" +) + +var _ types.QueryServer = Keeper{} + +func (k Keeper) RawCheckpoints(c context.Context, req *types.QueryRawCheckpointsRequest) (*types.QueryRawCheckpointsResponse, error) { + panic("TODO: implement this") +} + +func (k Keeper) RawCheckpoint(c context.Context, req *types.QueryRawCheckpointRequest) (*types.QueryRawCheckpointResponse, error) { + panic("TODO: implement this") +} + +func (k Keeper) LatestCheckpoint(c context.Context, req *types.QueryLatestCheckpointRequest) (*types.QueryLatestCheckpointResponse, error) { + panic("TODO: implement this") +} + +func (k Keeper) UncheckpointedCheckpoints(c context.Context, req *types.QueryUncheckpointedCheckpointsRequest) (*types.QueryUncheckpointedCheckpointsResponse, error) { + panic("TODO: implement this") +} + +func (k Keeper) UnderconfirmedCheckpoints(c context.Context, req *types.QueryUnderconfirmedCheckpointsRequest) (*types.QueryUnderconfirmedCheckpointsResponse, error) { + panic("TODO: implement this") +} + +func (k Keeper) ConfirmedCheckpoints(c context.Context, req *types.QueryConfirmedCheckpointsRequest) (*types.QueryConfirmedCheckpointsResponse, error) { + panic("TODO: implement this") +} diff --git a/x/checkpointing/keeper/msg_server.go b/x/checkpointing/keeper/msg_server.go index 7e387f374..f4f187337 100644 --- a/x/checkpointing/keeper/msg_server.go +++ b/x/checkpointing/keeper/msg_server.go @@ -9,7 +9,7 @@ type msgServer struct { k Keeper } -func (m msgServer) CollectBlsSig(ctx context.Context, header *types.MsgCollectBlsSig) (*types.MsgCollectBlsSigResponse, error) { +func (m msgServer) AddBlsSig(ctx context.Context, header *types.MsgAddBlsSig) (*types.MsgAddBlsSigResponse, error) { //TODO implement me panic("implement me") } diff --git a/x/checkpointing/types/checkpoint.pb.go b/x/checkpointing/types/checkpoint.pb.go new file mode 100644 index 000000000..806e2461c --- /dev/null +++ b/x/checkpointing/types/checkpoint.pb.go @@ -0,0 +1,929 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: babylon/checkpointing/checkpoint.proto + +package types + +import ( + bytes "bytes" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/regen-network/cosmos-proto" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + 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 + +// Status defines the status of the raw checkpoint +type RawCheckpoint_Status int32 + +const ( + // UNCHECKPOINTED indicates the checkpoint has not appeared on BTC + RawCheckpoint_UNCHECKPOINTED RawCheckpoint_Status = 0 + // CHECKPOINTED_NOT_CONFIRMED indicates the checkpoint has been checkpointed on BTC but has insufficent confirmation + RawCheckpoint_CHECKPOINTED_NOT_CONFIRMED RawCheckpoint_Status = 1 + // CONFIRMED indicates the checkpoint has sufficient confirmation depth on BTC + RawCheckpoint_CONFIRMED RawCheckpoint_Status = 2 +) + +var RawCheckpoint_Status_name = map[int32]string{ + 0: "UNCHECKPOINTED", + 1: "CHECKPOINTED_NOT_CONFIRMED", + 2: "CONFIRMED", +} + +var RawCheckpoint_Status_value = map[string]int32{ + "UNCHECKPOINTED": 0, + "CHECKPOINTED_NOT_CONFIRMED": 1, + "CONFIRMED": 2, +} + +func (x RawCheckpoint_Status) String() string { + return proto.EnumName(RawCheckpoint_Status_name, int32(x)) +} + +func (RawCheckpoint_Status) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_63ff05f0a47b36f7, []int{0, 0} +} + +// RawCheckpoint wraps the multi sig with meta data. +type RawCheckpoint struct { + // epoch_num defines the epoch number the raw checkpoint is for + EpochNum int64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` + // last_commit_hash defines the 'LastCommitHash' that individual bls sigs are signed on + LastCommitHash []byte `protobuf:"bytes,2,opt,name=last_commit_hash,json=lastCommitHash,proto3" json:"last_commit_hash,omitempty"` + // bitmap defines the bitmap that indicates the signers of the bls multi sig + Bitmap []byte `protobuf:"bytes,3,opt,name=bitmap,proto3" json:"bitmap,omitempty"` + // bls_multi_sig defines the multi sig that is aggregated from individual bls sigs + BlsMultiSig []byte `protobuf:"bytes,4,opt,name=bls_multi_sig,json=blsMultiSig,proto3" json:"bls_multi_sig,omitempty"` +} + +func (m *RawCheckpoint) Reset() { *m = RawCheckpoint{} } +func (*RawCheckpoint) ProtoMessage() {} +func (*RawCheckpoint) Descriptor() ([]byte, []int) { + return fileDescriptor_63ff05f0a47b36f7, []int{0} +} +func (m *RawCheckpoint) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RawCheckpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RawCheckpoint.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 *RawCheckpoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_RawCheckpoint.Merge(m, src) +} +func (m *RawCheckpoint) XXX_Size() int { + return m.Size() +} +func (m *RawCheckpoint) XXX_DiscardUnknown() { + xxx_messageInfo_RawCheckpoint.DiscardUnknown(m) +} + +var xxx_messageInfo_RawCheckpoint proto.InternalMessageInfo + +func (m *RawCheckpoint) GetEpochNum() int64 { + if m != nil { + return m.EpochNum + } + return 0 +} + +func (m *RawCheckpoint) GetLastCommitHash() []byte { + if m != nil { + return m.LastCommitHash + } + return nil +} + +func (m *RawCheckpoint) GetBitmap() []byte { + if m != nil { + return m.Bitmap + } + return nil +} + +func (m *RawCheckpoint) GetBlsMultiSig() []byte { + if m != nil { + return m.BlsMultiSig + } + return nil +} + +// BlsSig wraps the bls sig with meta data. +type BlsSig struct { + // epoch_num defines the epoch number that the bls sig is signed on + EpochNum int64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` + // last_commit_hash defines the 'LastCommitHash' that the bls sig is signed on + LastCommitHash []byte `protobuf:"bytes,2,opt,name=last_commit_hash,json=lastCommitHash,proto3" json:"last_commit_hash,omitempty"` + // bls_sig defines the actual bls sig + BlsSig []byte `protobuf:"bytes,3,opt,name=bls_sig,json=blsSig,proto3" json:"bls_sig,omitempty"` + Time *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=time,proto3" json:"time,omitempty"` + // can't find cosmos_proto.scalar when compiling + // string signer_address = 5 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // the signer_address defines the address of the signer + SignerAddress string `protobuf:"bytes,5,opt,name=signer_address,json=signerAddress,proto3" json:"signer_address,omitempty"` +} + +func (m *BlsSig) Reset() { *m = BlsSig{} } +func (m *BlsSig) String() string { return proto.CompactTextString(m) } +func (*BlsSig) ProtoMessage() {} +func (*BlsSig) Descriptor() ([]byte, []int) { + return fileDescriptor_63ff05f0a47b36f7, []int{1} +} +func (m *BlsSig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BlsSig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BlsSig.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 *BlsSig) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlsSig.Merge(m, src) +} +func (m *BlsSig) XXX_Size() int { + return m.Size() +} +func (m *BlsSig) XXX_DiscardUnknown() { + xxx_messageInfo_BlsSig.DiscardUnknown(m) +} + +var xxx_messageInfo_BlsSig proto.InternalMessageInfo + +func (m *BlsSig) GetEpochNum() int64 { + if m != nil { + return m.EpochNum + } + return 0 +} + +func (m *BlsSig) GetLastCommitHash() []byte { + if m != nil { + return m.LastCommitHash + } + return nil +} + +func (m *BlsSig) GetBlsSig() []byte { + if m != nil { + return m.BlsSig + } + return nil +} + +func (m *BlsSig) GetTime() *timestamppb.Timestamp { + if m != nil { + return m.Time + } + return nil +} + +func (m *BlsSig) GetSignerAddress() string { + if m != nil { + return m.SignerAddress + } + return "" +} + +func init() { + proto.RegisterEnum("babylon.checkpointing.v1.RawCheckpoint_Status", RawCheckpoint_Status_name, RawCheckpoint_Status_value) + proto.RegisterType((*RawCheckpoint)(nil), "babylon.checkpointing.v1.RawCheckpoint") + proto.RegisterType((*BlsSig)(nil), "babylon.checkpointing.v1.BlsSig") +} + +func init() { + proto.RegisterFile("babylon/checkpointing/checkpoint.proto", fileDescriptor_63ff05f0a47b36f7) +} + +var fileDescriptor_63ff05f0a47b36f7 = []byte{ + // 435 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0x4f, 0x6f, 0xd3, 0x30, + 0x18, 0xc6, 0xe3, 0x6d, 0x94, 0xd5, 0xa3, 0x55, 0x65, 0x21, 0x08, 0x45, 0x4a, 0xab, 0x4a, 0xa0, + 0x9e, 0x1c, 0x01, 0xe2, 0xc2, 0x8d, 0x65, 0x45, 0x9b, 0xa6, 0xa5, 0x28, 0x2d, 0x17, 0x2e, 0x96, + 0x9d, 0x05, 0xc7, 0x22, 0x8e, 0xa3, 0xda, 0x01, 0xf6, 0x2d, 0x38, 0x72, 0xdc, 0x37, 0xe1, 0xca, + 0x71, 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, 0x6a, 0x96, 0x56, 0x9b, + 0x02, 0x00, 0x00, +} + +func (this *RawCheckpoint) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RawCheckpoint) + if !ok { + that2, ok := that.(RawCheckpoint) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.EpochNum != that1.EpochNum { + return false + } + if !bytes.Equal(this.LastCommitHash, that1.LastCommitHash) { + return false + } + if !bytes.Equal(this.Bitmap, that1.Bitmap) { + return false + } + if !bytes.Equal(this.BlsMultiSig, that1.BlsMultiSig) { + return false + } + return true +} +func (m *RawCheckpoint) 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 *RawCheckpoint) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RawCheckpoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BlsMultiSig) > 0 { + i -= len(m.BlsMultiSig) + copy(dAtA[i:], m.BlsMultiSig) + i = encodeVarintCheckpoint(dAtA, i, uint64(len(m.BlsMultiSig))) + i-- + dAtA[i] = 0x22 + } + if len(m.Bitmap) > 0 { + i -= len(m.Bitmap) + copy(dAtA[i:], m.Bitmap) + i = encodeVarintCheckpoint(dAtA, i, uint64(len(m.Bitmap))) + i-- + dAtA[i] = 0x1a + } + if len(m.LastCommitHash) > 0 { + i -= len(m.LastCommitHash) + copy(dAtA[i:], m.LastCommitHash) + i = encodeVarintCheckpoint(dAtA, i, uint64(len(m.LastCommitHash))) + i-- + dAtA[i] = 0x12 + } + if m.EpochNum != 0 { + i = encodeVarintCheckpoint(dAtA, i, uint64(m.EpochNum)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *BlsSig) 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 *BlsSig) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlsSig) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SignerAddress) > 0 { + i -= len(m.SignerAddress) + copy(dAtA[i:], m.SignerAddress) + i = encodeVarintCheckpoint(dAtA, i, uint64(len(m.SignerAddress))) + i-- + dAtA[i] = 0x2a + } + if m.Time != nil { + { + size, err := m.Time.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCheckpoint(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if len(m.BlsSig) > 0 { + i -= len(m.BlsSig) + copy(dAtA[i:], m.BlsSig) + i = encodeVarintCheckpoint(dAtA, i, uint64(len(m.BlsSig))) + i-- + dAtA[i] = 0x1a + } + if len(m.LastCommitHash) > 0 { + i -= len(m.LastCommitHash) + copy(dAtA[i:], m.LastCommitHash) + i = encodeVarintCheckpoint(dAtA, i, uint64(len(m.LastCommitHash))) + i-- + dAtA[i] = 0x12 + } + if m.EpochNum != 0 { + i = encodeVarintCheckpoint(dAtA, i, uint64(m.EpochNum)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintCheckpoint(dAtA []byte, offset int, v uint64) int { + offset -= sovCheckpoint(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *RawCheckpoint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.EpochNum != 0 { + n += 1 + sovCheckpoint(uint64(m.EpochNum)) + } + l = len(m.LastCommitHash) + if l > 0 { + n += 1 + l + sovCheckpoint(uint64(l)) + } + l = len(m.Bitmap) + if l > 0 { + n += 1 + l + sovCheckpoint(uint64(l)) + } + l = len(m.BlsMultiSig) + if l > 0 { + n += 1 + l + sovCheckpoint(uint64(l)) + } + return n +} + +func (m *BlsSig) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.EpochNum != 0 { + n += 1 + sovCheckpoint(uint64(m.EpochNum)) + } + l = len(m.LastCommitHash) + if l > 0 { + n += 1 + l + sovCheckpoint(uint64(l)) + } + l = len(m.BlsSig) + if l > 0 { + n += 1 + l + sovCheckpoint(uint64(l)) + } + if m.Time != nil { + l = m.Time.Size() + n += 1 + l + sovCheckpoint(uint64(l)) + } + l = len(m.SignerAddress) + if l > 0 { + n += 1 + l + sovCheckpoint(uint64(l)) + } + return n +} + +func sovCheckpoint(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozCheckpoint(x uint64) (n int) { + return sovCheckpoint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *RawCheckpoint) 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 ErrIntOverflowCheckpoint + } + 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: RawCheckpoint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RawCheckpoint: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochNum", wireType) + } + m.EpochNum = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCheckpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochNum |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastCommitHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCheckpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthCheckpoint + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthCheckpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LastCommitHash = append(m.LastCommitHash[:0], dAtA[iNdEx:postIndex]...) + if m.LastCommitHash == nil { + m.LastCommitHash = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bitmap", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCheckpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthCheckpoint + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthCheckpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bitmap = append(m.Bitmap[:0], dAtA[iNdEx:postIndex]...) + if m.Bitmap == nil { + m.Bitmap = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlsMultiSig", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCheckpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthCheckpoint + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthCheckpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlsMultiSig = append(m.BlsMultiSig[:0], dAtA[iNdEx:postIndex]...) + if m.BlsMultiSig == nil { + m.BlsMultiSig = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCheckpoint(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCheckpoint + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BlsSig) 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 ErrIntOverflowCheckpoint + } + 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: BlsSig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlsSig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochNum", wireType) + } + m.EpochNum = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCheckpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochNum |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastCommitHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCheckpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthCheckpoint + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthCheckpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LastCommitHash = append(m.LastCommitHash[:0], dAtA[iNdEx:postIndex]...) + if m.LastCommitHash == nil { + m.LastCommitHash = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlsSig", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCheckpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthCheckpoint + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthCheckpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlsSig = append(m.BlsSig[:0], dAtA[iNdEx:postIndex]...) + if m.BlsSig == nil { + m.BlsSig = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCheckpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCheckpoint + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCheckpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Time == nil { + m.Time = ×tamppb.Timestamp{} + } + if err := m.Time.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SignerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCheckpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthCheckpoint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCheckpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SignerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCheckpoint(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCheckpoint + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipCheckpoint(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, ErrIntOverflowCheckpoint + } + 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, ErrIntOverflowCheckpoint + } + 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, ErrIntOverflowCheckpoint + } + 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, ErrInvalidLengthCheckpoint + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupCheckpoint + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthCheckpoint + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthCheckpoint = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCheckpoint = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupCheckpoint = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/checkpointing/types/codec.go b/x/checkpointing/types/codec.go index d08bdb183..4bb325044 100644 --- a/x/checkpointing/types/codec.go +++ b/x/checkpointing/types/codec.go @@ -14,7 +14,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { // Register messages registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgCollectBlsSig{}, + &MsgAddBlsSig{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/checkpointing/types/errors.go b/x/checkpointing/types/errors.go index 389c8e5ed..e4800ba76 100644 --- a/x/checkpointing/types/errors.go +++ b/x/checkpointing/types/errors.go @@ -1,4 +1,4 @@ package types -// x/checkpointing module sentinel errors +// x/checkpoint.proto module sentinel errors var () diff --git a/x/checkpointing/types/genesis.pb.go b/x/checkpointing/types/genesis.pb.go index 63e2899b1..9b860b92a 100644 --- a/x/checkpointing/types/genesis.pb.go +++ b/x/checkpointing/types/genesis.pb.go @@ -7,7 +7,6 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" @@ -24,7 +23,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// GenesisState defines the checkpointing module's genesis state. +// GenesisState defines the checkpoint.proto module's genesis state. type GenesisState struct { Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } @@ -69,158 +68,8 @@ func (m *GenesisState) GetParams() Params { return Params{} } -// RawCheckpoint wraps the multi sig with other meta data. -// This can go on a separate file. -type RawCheckpoint struct { - EpochNum int64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` - LastCommitHash []byte `protobuf:"bytes,2,opt,name=last_commit_hash,json=lastCommitHash,proto3" json:"last_commit_hash,omitempty"` - Bitmap []byte `protobuf:"bytes,3,opt,name=bitmap,proto3" json:"bitmap,omitempty"` - MultiSig []byte `protobuf:"bytes,4,opt,name=multi_sig,json=multiSig,proto3" json:"multi_sig,omitempty"` -} - -func (m *RawCheckpoint) Reset() { *m = RawCheckpoint{} } -func (m *RawCheckpoint) String() string { return proto.CompactTextString(m) } -func (*RawCheckpoint) ProtoMessage() {} -func (*RawCheckpoint) Descriptor() ([]byte, []int) { - return fileDescriptor_cdd0fb065da1de51, []int{1} -} -func (m *RawCheckpoint) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RawCheckpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RawCheckpoint.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 *RawCheckpoint) XXX_Merge(src proto.Message) { - xxx_messageInfo_RawCheckpoint.Merge(m, src) -} -func (m *RawCheckpoint) XXX_Size() int { - return m.Size() -} -func (m *RawCheckpoint) XXX_DiscardUnknown() { - xxx_messageInfo_RawCheckpoint.DiscardUnknown(m) -} - -var xxx_messageInfo_RawCheckpoint proto.InternalMessageInfo - -func (m *RawCheckpoint) GetEpochNum() int64 { - if m != nil { - return m.EpochNum - } - return 0 -} - -func (m *RawCheckpoint) GetLastCommitHash() []byte { - if m != nil { - return m.LastCommitHash - } - return nil -} - -func (m *RawCheckpoint) GetBitmap() []byte { - if m != nil { - return m.Bitmap - } - return nil -} - -func (m *RawCheckpoint) GetMultiSig() []byte { - if m != nil { - return m.MultiSig - } - return nil -} - -// BlsSig wraps the bls sig with other meta data. -// This can go on a separate file. -type BlsSig struct { - EpochNum int64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` - LastCommitHash []byte `protobuf:"bytes,2,opt,name=last_commit_hash,json=lastCommitHash,proto3" json:"last_commit_hash,omitempty"` - BlsSig []byte `protobuf:"bytes,3,opt,name=bls_sig,json=blsSig,proto3" json:"bls_sig,omitempty"` - Time *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=time,proto3" json:"time,omitempty"` - Signer string `protobuf:"bytes,5,opt,name=signer,proto3" json:"signer,omitempty"` -} - -func (m *BlsSig) Reset() { *m = BlsSig{} } -func (m *BlsSig) String() string { return proto.CompactTextString(m) } -func (*BlsSig) ProtoMessage() {} -func (*BlsSig) Descriptor() ([]byte, []int) { - return fileDescriptor_cdd0fb065da1de51, []int{2} -} -func (m *BlsSig) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BlsSig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BlsSig.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 *BlsSig) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlsSig.Merge(m, src) -} -func (m *BlsSig) XXX_Size() int { - return m.Size() -} -func (m *BlsSig) XXX_DiscardUnknown() { - xxx_messageInfo_BlsSig.DiscardUnknown(m) -} - -var xxx_messageInfo_BlsSig proto.InternalMessageInfo - -func (m *BlsSig) GetEpochNum() int64 { - if m != nil { - return m.EpochNum - } - return 0 -} - -func (m *BlsSig) GetLastCommitHash() []byte { - if m != nil { - return m.LastCommitHash - } - return nil -} - -func (m *BlsSig) GetBlsSig() []byte { - if m != nil { - return m.BlsSig - } - return nil -} - -func (m *BlsSig) GetTime() *timestamppb.Timestamp { - if m != nil { - return m.Time - } - return nil -} - -func (m *BlsSig) GetSigner() string { - if m != nil { - return m.Signer - } - return "" -} - func init() { proto.RegisterType((*GenesisState)(nil), "babylon.checkpointing.v1.GenesisState") - proto.RegisterType((*RawCheckpoint)(nil), "babylon.checkpointing.v1.RawCheckpoint") - proto.RegisterType((*BlsSig)(nil), "babylon.checkpointing.v1.BlsSig") } func init() { @@ -228,32 +77,20 @@ func init() { } var fileDescriptor_cdd0fb065da1de51 = []byte{ - // 387 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x91, 0xc1, 0x4e, 0xa3, 0x40, - 0x1c, 0xc6, 0x99, 0x6d, 0x97, 0x6d, 0xa7, 0xdd, 0xcd, 0x86, 0x6c, 0x76, 0x49, 0x37, 0xa1, 0x04, - 0x2f, 0x9c, 0x86, 0x58, 0xe3, 0xd5, 0x43, 0x7b, 0xd0, 0x53, 0x35, 0xd4, 0x93, 0x17, 0x32, 0x90, - 0x71, 0x98, 0xc8, 0x30, 0xa4, 0x33, 0xa8, 0x7d, 0x06, 0x2f, 0x3e, 0x8a, 0x8f, 0xd1, 0x63, 0x8f, - 0x9e, 0x8c, 0x69, 0x5f, 0xc4, 0x30, 0x80, 0x89, 0x46, 0x6f, 0xde, 0xf8, 0xbe, 0xff, 0x8f, 0xff, - 0xff, 0x83, 0x0f, 0xee, 0xc5, 0x38, 0x5e, 0x65, 0x22, 0x0f, 0x92, 0x94, 0x24, 0x57, 0x85, 0x60, - 0xb9, 0x62, 0x39, 0x0d, 0x28, 0xc9, 0x89, 0x64, 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0x73, - 0xd4, 0xfb, 0x11, 0xec, 0x56, 0xff, 0x5f, 0x47, 0x18, 0x4c, 0x46, 0xa8, 0x2e, 0x07, 0xb5, 0xe5, - 0xa0, 0xf3, 0xb6, 0x9c, 0x50, 0x73, 0xd5, 0xf7, 0x48, 0x46, 0x73, 0xb2, 0xb4, 0xbf, 0xbb, 0xc0, - 0xef, 0x87, 0x8d, 0x9a, 0x9e, 0xae, 0xb7, 0x0e, 0xd8, 0x6c, 0x1d, 0xf0, 0xbc, 0x75, 0xc0, 0xfd, - 0xce, 0x31, 0x36, 0x3b, 0xc7, 0x78, 0xdc, 0x39, 0xc6, 0xc5, 0x21, 0x65, 0x2a, 0x2d, 0x63, 0x94, - 0x08, 0x1e, 0x34, 0xa5, 0x24, 0x29, 0x66, 0x79, 0x2b, 0x82, 0xdb, 0x77, 0x45, 0xab, 0x55, 0x41, - 0x64, 0x6c, 0xea, 0x08, 0x07, 0x2f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x6d, 0xd5, 0x94, 0xe4, 0x84, - 0x02, 0x00, 0x00, + // 202 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4e, 0x4a, 0x4c, 0xaa, + 0xcc, 0xc9, 0xcf, 0xd3, 0x4f, 0xce, 0x48, 0x4d, 0xce, 0x2e, 0xc8, 0xcf, 0xcc, 0x2b, 0xc9, 0xcc, + 0x4b, 0xd7, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, + 0x92, 0x80, 0x2a, 0xd2, 0x43, 0x51, 0xa4, 0x57, 0x66, 0x28, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, + 0x56, 0xa4, 0x0f, 0x62, 0x41, 0xd4, 0x4b, 0x29, 0x61, 0x37, 0xb4, 0x20, 0xb1, 0x28, 0x31, 0x17, + 0x6a, 0xa6, 0x92, 0x1f, 0x17, 0x8f, 0x3b, 0xc4, 0x92, 0xe0, 0x92, 0xc4, 0x92, 0x54, 0x21, 0x3b, + 0x2e, 0x36, 0x88, 0xbc, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0x82, 0x1e, 0x2e, 0x4b, 0xf5, + 0x02, 0xc0, 0xea, 0x9c, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x82, 0xea, 0x72, 0xf2, 0x3f, 0xf1, + 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, + 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xd3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, + 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0xa8, 0x99, 0xc9, 0x19, 0x89, 0x99, 0x79, 0x30, 0x8e, 0x7e, 0x05, + 0x9a, 0x3b, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xee, 0x34, 0x06, 0x04, 0x00, 0x00, + 0xff, 0xff, 0x6f, 0x22, 0x63, 0xf1, 0x22, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -289,116 +126,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *RawCheckpoint) 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 *RawCheckpoint) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RawCheckpoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.MultiSig) > 0 { - i -= len(m.MultiSig) - copy(dAtA[i:], m.MultiSig) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.MultiSig))) - i-- - dAtA[i] = 0x22 - } - if len(m.Bitmap) > 0 { - i -= len(m.Bitmap) - copy(dAtA[i:], m.Bitmap) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.Bitmap))) - i-- - dAtA[i] = 0x1a - } - if len(m.LastCommitHash) > 0 { - i -= len(m.LastCommitHash) - copy(dAtA[i:], m.LastCommitHash) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.LastCommitHash))) - i-- - dAtA[i] = 0x12 - } - if m.EpochNum != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.EpochNum)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *BlsSig) 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 *BlsSig) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BlsSig) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Signer) > 0 { - i -= len(m.Signer) - copy(dAtA[i:], m.Signer) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.Signer))) - i-- - dAtA[i] = 0x2a - } - if m.Time != nil { - { - size, err := m.Time.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if len(m.BlsSig) > 0 { - i -= len(m.BlsSig) - copy(dAtA[i:], m.BlsSig) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.BlsSig))) - i-- - dAtA[i] = 0x1a - } - if len(m.LastCommitHash) > 0 { - i -= len(m.LastCommitHash) - copy(dAtA[i:], m.LastCommitHash) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.LastCommitHash))) - i-- - dAtA[i] = 0x12 - } - if m.EpochNum != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.EpochNum)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { offset -= sovGenesis(v) base := offset @@ -421,58 +148,6 @@ func (m *GenesisState) Size() (n int) { return n } -func (m *RawCheckpoint) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.EpochNum != 0 { - n += 1 + sovGenesis(uint64(m.EpochNum)) - } - l = len(m.LastCommitHash) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - l = len(m.Bitmap) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - l = len(m.MultiSig) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - return n -} - -func (m *BlsSig) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.EpochNum != 0 { - n += 1 + sovGenesis(uint64(m.EpochNum)) - } - l = len(m.LastCommitHash) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - l = len(m.BlsSig) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - if m.Time != nil { - l = m.Time.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - l = len(m.Signer) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - return n -} - func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -562,382 +237,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } -func (m *RawCheckpoint) 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 ErrIntOverflowGenesis - } - 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: RawCheckpoint: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RawCheckpoint: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EpochNum", wireType) - } - m.EpochNum = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.EpochNum |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastCommitHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LastCommitHash = append(m.LastCommitHash[:0], dAtA[iNdEx:postIndex]...) - if m.LastCommitHash == nil { - m.LastCommitHash = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bitmap", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bitmap = append(m.Bitmap[:0], dAtA[iNdEx:postIndex]...) - if m.Bitmap == nil { - m.Bitmap = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MultiSig", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MultiSig = append(m.MultiSig[:0], dAtA[iNdEx:postIndex]...) - if m.MultiSig == nil { - m.MultiSig = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BlsSig) 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 ErrIntOverflowGenesis - } - 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: BlsSig: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BlsSig: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EpochNum", wireType) - } - m.EpochNum = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.EpochNum |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastCommitHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LastCommitHash = append(m.LastCommitHash[:0], dAtA[iNdEx:postIndex]...) - if m.LastCommitHash == nil { - m.LastCommitHash = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlsSig", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BlsSig = append(m.BlsSig[:0], dAtA[iNdEx:postIndex]...) - if m.BlsSig == nil { - m.BlsSig = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Time == nil { - m.Time = ×tamppb.Timestamp{} - } - if err := m.Time.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/checkpointing/types/keys.go b/x/checkpointing/types/keys.go index 2c4e576d4..310a4f355 100644 --- a/x/checkpointing/types/keys.go +++ b/x/checkpointing/types/keys.go @@ -2,7 +2,7 @@ package types const ( // ModuleName defines the module name - ModuleName = "checkpointing" + ModuleName = "checkpoint.proto" // StoreKey defines the primary module store key StoreKey = ModuleName diff --git a/x/checkpointing/types/msgs.go b/x/checkpointing/types/msgs.go index 9c3faf871..2f3f41439 100644 --- a/x/checkpointing/types/msgs.go +++ b/x/checkpointing/types/msgs.go @@ -4,12 +4,12 @@ import sdk "github.com/cosmos/cosmos-sdk/types" var ( // Ensure that MsgInsertHeader implements all functions of the Msg interface - _ sdk.Msg = (*MsgCollectBlsSig)(nil) + _ sdk.Msg = (*MsgAddBlsSig)(nil) ) -func (m *MsgCollectBlsSig) ValidateBasic() error { +func (m *MsgAddBlsSig) ValidateBasic() error { // This function validates stateless message elements - _, err := sdk.AccAddressFromBech32(m.BlsSig.Signer) + _, err := sdk.AccAddressFromBech32(m.BlsSig.SignerAddress) if err != nil { return err } @@ -19,8 +19,8 @@ func (m *MsgCollectBlsSig) ValidateBasic() error { return nil } -func (m *MsgCollectBlsSig) GetSigners() []sdk.AccAddress { - signer, err := sdk.AccAddressFromBech32(m.BlsSig.Signer) +func (m *MsgAddBlsSig) GetSigners() []sdk.AccAddress { + signer, err := sdk.AccAddressFromBech32(m.BlsSig.SignerAddress) if err != nil { panic(err) } diff --git a/x/checkpointing/types/query.pb.go b/x/checkpointing/types/query.pb.go index 66e7d79f4..06d2a1f56 100644 --- a/x/checkpointing/types/query.pb.go +++ b/x/checkpointing/types/query.pb.go @@ -6,6 +6,7 @@ package types import ( context "context" fmt "fmt" + 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" @@ -32,8 +33,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // QueryRawCheckpointsRequest is the request type for the Query/RawCheckpoints // RPC method. type QueryRawCheckpointsRequest struct { - BottomEpoch int64 `protobuf:"varint,1,opt,name=bottom_epoch,json=bottomEpoch,proto3" json:"bottom_epoch,omitempty"` - TopEpoch int64 `protobuf:"varint,2,opt,name=top_epoch,json=topEpoch,proto3" json:"top_epoch,omitempty"` + // from_epoch defines the start epoch of the query, which is inclusive + FromEpochNum int64 `protobuf:"varint,1,opt,name=from_epoch_num,json=fromEpochNum,proto3" json:"from_epoch_num,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryRawCheckpointsRequest) Reset() { *m = QueryRawCheckpointsRequest{} } @@ -69,24 +72,26 @@ func (m *QueryRawCheckpointsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryRawCheckpointsRequest proto.InternalMessageInfo -func (m *QueryRawCheckpointsRequest) GetBottomEpoch() int64 { +func (m *QueryRawCheckpointsRequest) GetFromEpochNum() int64 { if m != nil { - return m.BottomEpoch + return m.FromEpochNum } return 0 } -func (m *QueryRawCheckpointsRequest) GetTopEpoch() int64 { +func (m *QueryRawCheckpointsRequest) GetPagination() *query.PageRequest { if m != nil { - return m.TopEpoch + return m.Pagination } - return 0 + return nil } -// QeuryRawCheckpointsResponse is the response type for the Query/RawCheckpoints +// QueryRawCheckpointsResponse is the response type for the Query/RawCheckpoints // RPC method. type QueryRawCheckpointsResponse struct { RawCheckpoints []*RawCheckpoint `protobuf:"bytes,1,rep,name=raw_checkpoints,json=rawCheckpoints,proto3" json:"raw_checkpoints,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryRawCheckpointsResponse) Reset() { *m = QueryRawCheckpointsResponse{} } @@ -129,22 +134,34 @@ func (m *QueryRawCheckpointsResponse) GetRawCheckpoints() []*RawCheckpoint { return nil } -// QueryParamsRequest is request type for the Query/Params RPC method. -type QueryParamsRequest struct { +func (m *QueryRawCheckpointsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil } -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { +// QueryRawCheckpointRequest is the request type for the Query/RawCheckpoint +// RPC method. +type QueryRawCheckpointRequest struct { + // epoch_num defines the epoch for the queried checkpoint + EpochNum int64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryRawCheckpointRequest) Reset() { *m = QueryRawCheckpointRequest{} } +func (m *QueryRawCheckpointRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRawCheckpointRequest) ProtoMessage() {} +func (*QueryRawCheckpointRequest) Descriptor() ([]byte, []int) { return fileDescriptor_a0fdb8f0f85bb51e, []int{2} } -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryRawCheckpointRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryRawCheckpointRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryRawCheckpointRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -154,36 +171,52 @@ func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) +func (m *QueryRawCheckpointRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRawCheckpointRequest.Merge(m, src) } -func (m *QueryParamsRequest) XXX_Size() int { +func (m *QueryRawCheckpointRequest) XXX_Size() int { return m.Size() } -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +func (m *QueryRawCheckpointRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRawCheckpointRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryRawCheckpointRequest proto.InternalMessageInfo -// QueryParamsResponse is response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // params holds all the parameters of this module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +func (m *QueryRawCheckpointRequest) GetEpochNum() int64 { + if m != nil { + return m.EpochNum + } + return 0 } -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { +func (m *QueryRawCheckpointRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryRawCheckpointResponse is the response type for the Query/RawCheckpoint +// RPC method. +type QueryRawCheckpointResponse struct { + RawCheckpoint *RawCheckpoint `protobuf:"bytes,1,opt,name=raw_checkpoint,json=rawCheckpoint,proto3" json:"raw_checkpoint,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryRawCheckpointResponse) Reset() { *m = QueryRawCheckpointResponse{} } +func (m *QueryRawCheckpointResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRawCheckpointResponse) ProtoMessage() {} +func (*QueryRawCheckpointResponse) Descriptor() ([]byte, []int) { return fileDescriptor_a0fdb8f0f85bb51e, []int{3} } -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryRawCheckpointResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryRawCheckpointResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryRawCheckpointResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -193,378 +226,3266 @@ func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) +func (m *QueryRawCheckpointResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRawCheckpointResponse.Merge(m, src) } -func (m *QueryParamsResponse) XXX_Size() int { +func (m *QueryRawCheckpointResponse) XXX_Size() int { return m.Size() } -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +func (m *QueryRawCheckpointResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRawCheckpointResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryRawCheckpointResponse proto.InternalMessageInfo -func (m *QueryParamsResponse) GetParams() Params { +func (m *QueryRawCheckpointResponse) GetRawCheckpoint() *RawCheckpoint { if m != nil { - return m.Params + return m.RawCheckpoint } - return Params{} + return nil } -func init() { - proto.RegisterType((*QueryRawCheckpointsRequest)(nil), "babylon.checkpointing.v1.QueryRawCheckpointsRequest") - proto.RegisterType((*QueryRawCheckpointsResponse)(nil), "babylon.checkpointing.v1.QueryRawCheckpointsResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "babylon.checkpointing.v1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "babylon.checkpointing.v1.QueryParamsResponse") +func (m *QueryRawCheckpointResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil } -func init() { proto.RegisterFile("babylon/checkpointing/query.proto", fileDescriptor_a0fdb8f0f85bb51e) } - -var fileDescriptor_a0fdb8f0f85bb51e = []byte{ - // 407 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xcf, 0x8b, 0xd3, 0x40, - 0x14, 0xc7, 0x93, 0x56, 0x8b, 0x4e, 0xa5, 0xc2, 0xd8, 0x43, 0x49, 0x25, 0xb6, 0xf1, 0x60, 0x91, - 0x9a, 0x60, 0xb4, 0x57, 0x0f, 0x15, 0xcf, 0xd6, 0x80, 0x17, 0x11, 0xca, 0x24, 0x0c, 0x49, 0xb0, - 0x9d, 0x37, 0xcd, 0x4c, 0xad, 0x3d, 0x78, 0xf1, 0x2f, 0x10, 0x3c, 0x79, 0xf5, 0xaf, 0xe9, 0xb1, - 0xe0, 0x65, 0x4f, 0xcb, 0xd2, 0xee, 0x1f, 0xb2, 0x74, 0x32, 0xbb, 0x4b, 0x96, 0x64, 0x7f, 0xdc, - 0x86, 0xf7, 0x3e, 0xef, 0xfb, 0x7d, 0xef, 0xcb, 0xa0, 0x7e, 0x48, 0xc2, 0xf5, 0x0c, 0x98, 0x17, - 0x25, 0x34, 0xfa, 0xc6, 0x21, 0x65, 0x32, 0x65, 0xb1, 0xb7, 0x58, 0xd2, 0x6c, 0xed, 0xf2, 0x0c, - 0x24, 0xe0, 0x8e, 0x46, 0xdc, 0x02, 0xe2, 0x7e, 0x7f, 0x6d, 0xb5, 0x63, 0x88, 0x41, 0x41, 0xde, - 0xe1, 0x95, 0xf3, 0xd6, 0xd3, 0x18, 0x20, 0x9e, 0x51, 0x8f, 0xf0, 0xd4, 0x23, 0x8c, 0x81, 0x24, - 0x32, 0x05, 0x26, 0x74, 0xd7, 0x29, 0x37, 0xe4, 0x24, 0x23, 0xf3, 0x73, 0xe6, 0x79, 0x39, 0x13, - 0x53, 0x46, 0x45, 0xaa, 0x21, 0xe7, 0x2b, 0xb2, 0x3e, 0x1d, 0xb6, 0x0c, 0xc8, 0xea, 0xfd, 0x05, - 0x26, 0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, 0xfc, 0xbd, 0xb7, 0x8d, 0xed, 0xde, 0x36, 0x8e, - 0xf6, 0xb6, 0xf1, 0x65, 0x14, 0xa7, 0x32, 0x59, 0x86, 0x6e, 0x04, 0xf3, 0x72, 0xbd, 0x1f, 0x57, - 0x14, 0xe5, 0x9a, 0x53, 0x11, 0x36, 0xd4, 0xc7, 0x7d, 0x73, 0x16, 0x00, 0x00, 0xff, 0xff, 0xd7, - 0x57, 0xdf, 0x4f, 0x74, 0x03, 0x00, 0x00, +// QueryLatestCheckpointRequest is the request type for the Query/LatestCheckpoint +// RPC method. +type QueryLatestCheckpointRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn +func (m *QueryLatestCheckpointRequest) Reset() { *m = QueryLatestCheckpointRequest{} } +func (m *QueryLatestCheckpointRequest) String() string { return proto.CompactTextString(m) } +func (*QueryLatestCheckpointRequest) ProtoMessage() {} +func (*QueryLatestCheckpointRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a0fdb8f0f85bb51e, []int{4} +} +func (m *QueryLatestCheckpointRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLatestCheckpointRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLatestCheckpointRequest.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 *QueryLatestCheckpointRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLatestCheckpointRequest.Merge(m, src) +} +func (m *QueryLatestCheckpointRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryLatestCheckpointRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLatestCheckpointRequest.DiscardUnknown(m) +} -// 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 +var xxx_messageInfo_QueryLatestCheckpointRequest proto.InternalMessageInfo -// 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 { - // RawCheckpoints queries a list of checkpoints from a range of epochs. - RawCheckpoints(ctx context.Context, in *QueryRawCheckpointsRequest, opts ...grpc.CallOption) (*QueryRawCheckpointsResponse, error) - // Parameters queries the parameters of the module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +func (m *QueryLatestCheckpointRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil } -type queryClient struct { - cc grpc1.ClientConn +// QueryLatestCheckpointResponse is the response type for the Query/LatestCheckpoint +// RPC method. +type QueryLatestCheckpointResponse struct { + LatestCheckpoint *RawCheckpoint `protobuf:"bytes,1,opt,name=latest_checkpoint,json=latestCheckpoint,proto3" json:"latest_checkpoint,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} +func (m *QueryLatestCheckpointResponse) Reset() { *m = QueryLatestCheckpointResponse{} } +func (m *QueryLatestCheckpointResponse) String() string { return proto.CompactTextString(m) } +func (*QueryLatestCheckpointResponse) ProtoMessage() {} +func (*QueryLatestCheckpointResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a0fdb8f0f85bb51e, []int{5} } - -func (c *queryClient) RawCheckpoints(ctx context.Context, in *QueryRawCheckpointsRequest, opts ...grpc.CallOption) (*QueryRawCheckpointsResponse, error) { - out := new(QueryRawCheckpointsResponse) - err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/RawCheckpoints", in, out, opts...) - if err != nil { - return nil, err +func (m *QueryLatestCheckpointResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLatestCheckpointResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLatestCheckpointResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return out, nil +} +func (m *QueryLatestCheckpointResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLatestCheckpointResponse.Merge(m, src) +} +func (m *QueryLatestCheckpointResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryLatestCheckpointResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLatestCheckpointResponse.DiscardUnknown(m) } -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/Params", in, out, opts...) - if err != nil { - return nil, err +var xxx_messageInfo_QueryLatestCheckpointResponse proto.InternalMessageInfo + +func (m *QueryLatestCheckpointResponse) GetLatestCheckpoint() *RawCheckpoint { + if m != nil { + return m.LatestCheckpoint } - return out, nil + return nil } -// QueryServer is the server API for Query service. -type QueryServer interface { - // RawCheckpoints queries a list of checkpoints from a range of epochs. - RawCheckpoints(context.Context, *QueryRawCheckpointsRequest) (*QueryRawCheckpointsResponse, error) - // Parameters queries the parameters of the module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +func (m *QueryLatestCheckpointResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil } -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { +// QueryUncheckpointedCheckpointsRequest is the request type for the Query/UncheckpointedCheckpoints +// RPC method. +type QueryUncheckpointedCheckpointsRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (*UnimplementedQueryServer) RawCheckpoints(ctx context.Context, req *QueryRawCheckpointsRequest) (*QueryRawCheckpointsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RawCheckpoints not implemented") +func (m *QueryUncheckpointedCheckpointsRequest) Reset() { *m = QueryUncheckpointedCheckpointsRequest{} } +func (m *QueryUncheckpointedCheckpointsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryUncheckpointedCheckpointsRequest) ProtoMessage() {} +func (*QueryUncheckpointedCheckpointsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a0fdb8f0f85bb51e, []int{6} } -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) +func (m *QueryUncheckpointedCheckpointsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } - -func _Query_RawCheckpoints_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRawCheckpointsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).RawCheckpoints(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/babylon.checkpointing.v1.Query/RawCheckpoints", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).RawCheckpoints(ctx, req.(*QueryRawCheckpointsRequest)) +func (m *QueryUncheckpointedCheckpointsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryUncheckpointedCheckpointsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return interceptor(ctx, in, info, handler) +} +func (m *QueryUncheckpointedCheckpointsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUncheckpointedCheckpointsRequest.Merge(m, src) +} +func (m *QueryUncheckpointedCheckpointsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryUncheckpointedCheckpointsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUncheckpointedCheckpointsRequest.DiscardUnknown(m) } -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: "/babylon.checkpointing.v1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) +var xxx_messageInfo_QueryUncheckpointedCheckpointsRequest proto.InternalMessageInfo + +func (m *QueryUncheckpointedCheckpointsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination } - return interceptor(ctx, in, info, handler) + return nil } -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "babylon.checkpointing.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "RawCheckpoints", - Handler: _Query_RawCheckpoints_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "babylon/checkpointing/query.proto", +// QueryUncheckpointedCheckpointsResponse is the response type for the Query/UncheckpointedCheckpoints +// RPC method. +type QueryUncheckpointedCheckpointsResponse struct { + UncheckpointedCheckpoint []*RawCheckpoint `protobuf:"bytes,1,rep,name=uncheckpointed_checkpoint,json=uncheckpointedCheckpoint,proto3" json:"uncheckpointed_checkpoint,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryRawCheckpointsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryUncheckpointedCheckpointsResponse) Reset() { + *m = QueryUncheckpointedCheckpointsResponse{} +} +func (m *QueryUncheckpointedCheckpointsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryUncheckpointedCheckpointsResponse) ProtoMessage() {} +func (*QueryUncheckpointedCheckpointsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a0fdb8f0f85bb51e, []int{7} +} +func (m *QueryUncheckpointedCheckpointsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryUncheckpointedCheckpointsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryUncheckpointedCheckpointsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return dAtA[:n], nil } - -func (m *QueryRawCheckpointsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *QueryUncheckpointedCheckpointsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUncheckpointedCheckpointsResponse.Merge(m, src) +} +func (m *QueryUncheckpointedCheckpointsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryUncheckpointedCheckpointsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUncheckpointedCheckpointsResponse.DiscardUnknown(m) } -func (m *QueryRawCheckpointsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.TopEpoch != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.TopEpoch)) - i-- - dAtA[i] = 0x10 - } - if m.BottomEpoch != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.BottomEpoch)) - i-- - dAtA[i] = 0x8 +var xxx_messageInfo_QueryUncheckpointedCheckpointsResponse proto.InternalMessageInfo + +func (m *QueryUncheckpointedCheckpointsResponse) GetUncheckpointedCheckpoint() []*RawCheckpoint { + if m != nil { + return m.UncheckpointedCheckpoint } - return len(dAtA) - i, nil + return nil } -func (m *QueryRawCheckpointsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryUncheckpointedCheckpointsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination } - return dAtA[:n], nil + return nil } -func (m *QueryRawCheckpointsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +// QueryUnderconfirmedCheckpointsRequest is the request type for the Query/UnderconfirmedCheckpoints +// RPC method. +type QueryUnderconfirmedCheckpointsRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryRawCheckpointsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.RawCheckpoints) > 0 { - for iNdEx := len(m.RawCheckpoints) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.RawCheckpoints[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa +func (m *QueryUnderconfirmedCheckpointsRequest) Reset() { *m = QueryUnderconfirmedCheckpointsRequest{} } +func (m *QueryUnderconfirmedCheckpointsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryUnderconfirmedCheckpointsRequest) ProtoMessage() {} +func (*QueryUnderconfirmedCheckpointsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a0fdb8f0f85bb51e, []int{8} +} +func (m *QueryUnderconfirmedCheckpointsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryUnderconfirmedCheckpointsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryUnderconfirmedCheckpointsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - return len(dAtA) - i, nil +} +func (m *QueryUnderconfirmedCheckpointsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUnderconfirmedCheckpointsRequest.Merge(m, src) +} +func (m *QueryUnderconfirmedCheckpointsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryUnderconfirmedCheckpointsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUnderconfirmedCheckpointsRequest.DiscardUnknown(m) } -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 +var xxx_messageInfo_QueryUnderconfirmedCheckpointsRequest proto.InternalMessageInfo + +func (m *QueryUnderconfirmedCheckpointsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination } - return dAtA[:n], nil + return nil } -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +// QueryUnderconfirmedCheckpointsResponse is the response type for the Query/UnderconfirmedCheckpoints +// RPC method. +type QueryUnderconfirmedCheckpointsResponse struct { + UnderconfirmedCheckpoint []*RawCheckpoint `protobuf:"bytes,1,rep,name=underconfirmed_checkpoint,json=underconfirmedCheckpoint,proto3" json:"underconfirmed_checkpoint,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil +func (m *QueryUnderconfirmedCheckpointsResponse) Reset() { + *m = QueryUnderconfirmedCheckpointsResponse{} +} +func (m *QueryUnderconfirmedCheckpointsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryUnderconfirmedCheckpointsResponse) ProtoMessage() {} +func (*QueryUnderconfirmedCheckpointsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a0fdb8f0f85bb51e, []int{9} +} +func (m *QueryUnderconfirmedCheckpointsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryUnderconfirmedCheckpointsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryUnderconfirmedCheckpointsResponse.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 *QueryUnderconfirmedCheckpointsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUnderconfirmedCheckpointsResponse.Merge(m, src) +} +func (m *QueryUnderconfirmedCheckpointsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryUnderconfirmedCheckpointsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUnderconfirmedCheckpointsResponse.DiscardUnknown(m) } -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 +var xxx_messageInfo_QueryUnderconfirmedCheckpointsResponse proto.InternalMessageInfo + +func (m *QueryUnderconfirmedCheckpointsResponse) GetUnderconfirmedCheckpoint() []*RawCheckpoint { + if m != nil { + return m.UnderconfirmedCheckpoint } - return dAtA[:n], nil + return nil } -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *QueryUnderconfirmedCheckpointsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil } -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) +// QueryConfirmedCheckpointsRequest is the request type for the Query/ConfirmedCheckpoints +// RPC method. +type QueryConfirmedCheckpointsRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryConfirmedCheckpointsRequest) Reset() { *m = QueryConfirmedCheckpointsRequest{} } +func (m *QueryConfirmedCheckpointsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryConfirmedCheckpointsRequest) ProtoMessage() {} +func (*QueryConfirmedCheckpointsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a0fdb8f0f85bb51e, []int{10} +} +func (m *QueryConfirmedCheckpointsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryConfirmedCheckpointsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryConfirmedCheckpointsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) if err != nil { - return 0, err + return nil, err + } + return b[:n], nil + } +} +func (m *QueryConfirmedCheckpointsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConfirmedCheckpointsRequest.Merge(m, src) +} +func (m *QueryConfirmedCheckpointsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryConfirmedCheckpointsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConfirmedCheckpointsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryConfirmedCheckpointsRequest proto.InternalMessageInfo + +func (m *QueryConfirmedCheckpointsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryConfirmedCheckpointsResponse is the response type for the Query/ConfirmedCheckpoints +// RPC method. +type QueryConfirmedCheckpointsResponse struct { + ConfirmedCheckpoint []*RawCheckpoint `protobuf:"bytes,1,rep,name=confirmed_checkpoint,json=confirmedCheckpoint,proto3" json:"confirmed_checkpoint,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryConfirmedCheckpointsResponse) Reset() { *m = QueryConfirmedCheckpointsResponse{} } +func (m *QueryConfirmedCheckpointsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryConfirmedCheckpointsResponse) ProtoMessage() {} +func (*QueryConfirmedCheckpointsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a0fdb8f0f85bb51e, []int{11} +} +func (m *QueryConfirmedCheckpointsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryConfirmedCheckpointsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryConfirmedCheckpointsResponse.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 *QueryConfirmedCheckpointsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConfirmedCheckpointsResponse.Merge(m, src) +} +func (m *QueryConfirmedCheckpointsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryConfirmedCheckpointsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConfirmedCheckpointsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryConfirmedCheckpointsResponse proto.InternalMessageInfo + +func (m *QueryConfirmedCheckpointsResponse) GetConfirmedCheckpoint() []*RawCheckpoint { + if m != nil { + return m.ConfirmedCheckpoint + } + return nil +} + +func (m *QueryConfirmedCheckpointsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryBlsSigsRequest is the request type for the Query/BlsSigs +// RPC method. +type QueryBlsSigsRequest struct { + // epoch_num defines the epoch for the queried bls sigs + EpochNum int64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryBlsSigsRequest) Reset() { *m = QueryBlsSigsRequest{} } +func (m *QueryBlsSigsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBlsSigsRequest) ProtoMessage() {} +func (*QueryBlsSigsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a0fdb8f0f85bb51e, []int{12} +} +func (m *QueryBlsSigsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBlsSigsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBlsSigsRequest.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 *QueryBlsSigsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlsSigsRequest.Merge(m, src) +} +func (m *QueryBlsSigsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBlsSigsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlsSigsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBlsSigsRequest proto.InternalMessageInfo + +func (m *QueryBlsSigsRequest) GetEpochNum() int64 { + if m != nil { + return m.EpochNum + } + return 0 +} + +func (m *QueryBlsSigsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryBlsSigsResponse is the response type for the Query/BlsSigs +// RPC method. +type QueryBlsSigsResponse struct { + BlsSigs []*BlsSig `protobuf:"bytes,1,rep,name=bls_sigs,json=blsSigs,proto3" json:"bls_sigs,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryBlsSigsResponse) Reset() { *m = QueryBlsSigsResponse{} } +func (m *QueryBlsSigsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBlsSigsResponse) ProtoMessage() {} +func (*QueryBlsSigsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a0fdb8f0f85bb51e, []int{13} +} +func (m *QueryBlsSigsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBlsSigsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBlsSigsResponse.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 *QueryBlsSigsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlsSigsResponse.Merge(m, src) +} +func (m *QueryBlsSigsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBlsSigsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlsSigsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBlsSigsResponse proto.InternalMessageInfo + +func (m *QueryBlsSigsResponse) GetBlsSigs() []*BlsSig { + if m != nil { + return m.BlsSigs + } + return nil +} + +func (m *QueryBlsSigsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryParamsRequest is request type for the Query/Params 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_a0fdb8f0f85bb51e, []int{14} +} +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 response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + 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_a0fdb8f0f85bb51e, []int{15} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*QueryRawCheckpointsRequest)(nil), "babylon.checkpointing.v1.QueryRawCheckpointsRequest") + proto.RegisterType((*QueryRawCheckpointsResponse)(nil), "babylon.checkpointing.v1.QueryRawCheckpointsResponse") + proto.RegisterType((*QueryRawCheckpointRequest)(nil), "babylon.checkpointing.v1.QueryRawCheckpointRequest") + proto.RegisterType((*QueryRawCheckpointResponse)(nil), "babylon.checkpointing.v1.QueryRawCheckpointResponse") + proto.RegisterType((*QueryLatestCheckpointRequest)(nil), "babylon.checkpointing.v1.QueryLatestCheckpointRequest") + proto.RegisterType((*QueryLatestCheckpointResponse)(nil), "babylon.checkpointing.v1.QueryLatestCheckpointResponse") + proto.RegisterType((*QueryUncheckpointedCheckpointsRequest)(nil), "babylon.checkpointing.v1.QueryUncheckpointedCheckpointsRequest") + proto.RegisterType((*QueryUncheckpointedCheckpointsResponse)(nil), "babylon.checkpointing.v1.QueryUncheckpointedCheckpointsResponse") + proto.RegisterType((*QueryUnderconfirmedCheckpointsRequest)(nil), "babylon.checkpointing.v1.QueryUnderconfirmedCheckpointsRequest") + proto.RegisterType((*QueryUnderconfirmedCheckpointsResponse)(nil), "babylon.checkpointing.v1.QueryUnderconfirmedCheckpointsResponse") + proto.RegisterType((*QueryConfirmedCheckpointsRequest)(nil), "babylon.checkpointing.v1.QueryConfirmedCheckpointsRequest") + proto.RegisterType((*QueryConfirmedCheckpointsResponse)(nil), "babylon.checkpointing.v1.QueryConfirmedCheckpointsResponse") + proto.RegisterType((*QueryBlsSigsRequest)(nil), "babylon.checkpointing.v1.QueryBlsSigsRequest") + proto.RegisterType((*QueryBlsSigsResponse)(nil), "babylon.checkpointing.v1.QueryBlsSigsResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "babylon.checkpointing.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "babylon.checkpointing.v1.QueryParamsResponse") +} + +func init() { proto.RegisterFile("babylon/checkpointing/query.proto", fileDescriptor_a0fdb8f0f85bb51e) } + +var fileDescriptor_a0fdb8f0f85bb51e = []byte{ + // 876 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x97, 0xcf, 0x4f, 0x13, 0x4d, + 0x18, 0xc7, 0x3b, 0xf0, 0xbe, 0xc0, 0x3b, 0xbc, 0x54, 0x1c, 0x7a, 0x28, 0x0b, 0xd6, 0xd2, 0x28, + 0x34, 0x2a, 0xbb, 0x96, 0x9f, 0x09, 0x10, 0x35, 0x25, 0xea, 0xc5, 0x20, 0x56, 0xb9, 0x70, 0x69, + 0x76, 0xcb, 0xb2, 0x5d, 0x6d, 0x77, 0x96, 0x9d, 0x2d, 0x88, 0xc4, 0xc4, 0x78, 0xf4, 0xa2, 0x89, + 0x57, 0x0f, 0xfe, 0x13, 0x26, 0x9c, 0x4c, 0xbc, 0xf5, 0x48, 0xe2, 0x41, 0x0f, 0xc6, 0x18, 0xf0, + 0xff, 0xd0, 0x74, 0x76, 0x4a, 0x99, 0xb2, 0xd3, 0x6d, 0xa1, 0x70, 0x5b, 0x66, 0x9f, 0x1f, 0xdf, + 0xef, 0x67, 0xd9, 0x7d, 0x9e, 0xc2, 0x11, 0x4d, 0xd5, 0xb6, 0x0b, 0xd8, 0x52, 0x72, 0x79, 0x3d, + 0xf7, 0xcc, 0xc6, 0xa6, 0xe5, 0x9a, 0x96, 0xa1, 0x6c, 0x94, 0x74, 0x67, 0x5b, 0xb6, 0x1d, 0xec, + 0x62, 0x14, 0x65, 0x21, 0x32, 0x17, 0x22, 0x6f, 0xa6, 0xa4, 0x6b, 0x39, 0x4c, 0x8a, 0x98, 0x28, + 0x9a, 0x4a, 0x74, 0x2f, 0x45, 0xd9, 0x4c, 0x69, 0xba, 0xab, 0xa6, 0x14, 0x5b, 0x35, 0x4c, 0x4b, + 0x75, 0x4d, 0x6c, 0x79, 0x55, 0xa4, 0x88, 0x81, 0x0d, 0x4c, 0x2f, 0x95, 0xca, 0x15, 0x3b, 0x1d, + 0x36, 0x30, 0x36, 0x0a, 0xba, 0xa2, 0xda, 0xa6, 0xa2, 0x5a, 0x16, 0x76, 0x69, 0x0a, 0x61, 0x77, + 0x13, 0xfe, 0xe2, 0x6c, 0xd5, 0x51, 0x8b, 0xd5, 0x98, 0x51, 0xff, 0x98, 0xda, 0x5f, 0x5e, 0x5c, + 0xe2, 0x0d, 0x80, 0xd2, 0xa3, 0x8a, 0xc4, 0x8c, 0xba, 0xb5, 0x78, 0x78, 0x93, 0x64, 0xf4, 0x8d, + 0x92, 0x4e, 0x5c, 0x74, 0x05, 0x86, 0xd7, 0x1d, 0x5c, 0xcc, 0xea, 0x36, 0xce, 0xe5, 0xb3, 0x56, + 0xa9, 0x18, 0x05, 0x71, 0x90, 0xec, 0xcc, 0xfc, 0x5f, 0x39, 0xbd, 0x5b, 0x39, 0x5c, 0x2a, 0x15, + 0xd1, 0x3d, 0x08, 0x6b, 0xc6, 0xa2, 0x1d, 0x71, 0x90, 0xec, 0x9d, 0x18, 0x95, 0x3d, 0x0a, 0x72, + 0x85, 0x82, 0xec, 0x81, 0x63, 0x14, 0xe4, 0x65, 0xd5, 0xd0, 0x59, 0x87, 0xcc, 0x91, 0xcc, 0xc4, + 0x2e, 0x80, 0x43, 0xbe, 0x62, 0x88, 0x8d, 0x2d, 0xa2, 0xa3, 0x65, 0x78, 0xc1, 0x51, 0xb7, 0xb2, + 0x35, 0x13, 0x24, 0x0a, 0xe2, 0x9d, 0xc9, 0xde, 0x89, 0x31, 0x59, 0xf4, 0x30, 0x64, 0xae, 0x54, + 0x26, 0xec, 0x70, 0x95, 0xd1, 0x7d, 0x1f, 0xe5, 0x63, 0x81, 0xca, 0x3d, 0x39, 0x9c, 0xf4, 0x57, + 0x00, 0x0e, 0x1e, 0x97, 0x5e, 0xc5, 0x38, 0x04, 0xff, 0xab, 0x27, 0xd8, 0xa3, 0xb7, 0x9b, 0xde, + 0x27, 0xdf, 0x47, 0x79, 0x08, 0x6f, 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x0c, 0x60, 0xc4, 0x6f, 0x9e, 0xa0, 0xb9, 0x00, 0x61, 0x0d, 0x26, 0x9e, 0x34, + 0x7f, 0xa2, 0x5c, 0xe6, 0x67, 0x96, 0xfa, 0x49, 0x21, 0x45, 0xec, 0xc7, 0xdf, 0xca, 0x47, 0x00, + 0xbb, 0xd9, 0x37, 0x1d, 0x8d, 0x07, 0x28, 0xe0, 0x07, 0x8f, 0x24, 0x37, 0x1b, 0xce, 0x34, 0xce, + 0x50, 0x8d, 0x37, 0x91, 0x2c, 0xd6, 0x58, 0x1d, 0x25, 0xdc, 0x6b, 0xfe, 0x16, 0xc0, 0x2e, 0xef, + 0x43, 0x8c, 0x6e, 0x04, 0xb4, 0xe4, 0xbe, 0xff, 0xd2, 0x78, 0x93, 0xd1, 0x4c, 0x5f, 0x92, 0xea, + 0x4b, 0xa0, 0xb8, 0x58, 0x9f, 0x37, 0x01, 0xd2, 0x0f, 0xcb, 0xfb, 0x31, 0xb0, 0xb7, 0x1f, 0x03, + 0xbf, 0xf6, 0x63, 0xe0, 0xdd, 0x41, 0x2c, 0xb4, 0x77, 0x10, 0x0b, 0x7d, 0x3f, 0x88, 0x85, 0x56, + 0xa7, 0x0d, 0xd3, 0xcd, 0x97, 0x34, 0x39, 0x87, 0x8b, 0xd5, 0x2a, 0xb9, 0xbc, 0x6a, 0x5a, 0x87, + 0x25, 0x9f, 0xd7, 0x15, 0x75, 0xb7, 0x6d, 0x9d, 0x68, 0x5d, 0xf4, 0xa7, 0xf5, 0xe4, 0xdf, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x5e, 0x65, 0xa3, 0xeb, 0x45, 0x10, 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 { + // RawCheckpoints queries a list of checkpoints starting from a given epoch number to the current epoch number. + RawCheckpoints(ctx context.Context, in *QueryRawCheckpointsRequest, opts ...grpc.CallOption) (*QueryRawCheckpointsResponse, error) + // RawCheckpoint queries a checkpoints at a given epoch number. + RawCheckpoint(ctx context.Context, in *QueryRawCheckpointRequest, opts ...grpc.CallOption) (*QueryRawCheckpointResponse, error) + // LatestCheckpoint queries the latest checkpoint. + LatestCheckpoint(ctx context.Context, in *QueryLatestCheckpointRequest, opts ...grpc.CallOption) (*QueryLatestCheckpointResponse, error) + // UncheckpointedCheckpoints queries a list of checkpoints with the status of UNCHECKPOINTED. + UncheckpointedCheckpoints(ctx context.Context, in *QueryUncheckpointedCheckpointsRequest, opts ...grpc.CallOption) (*QueryUncheckpointedCheckpointsResponse, error) + // UnderconfirmedCheckpoints queries a list of checkpoints with the status of CHECKPOINTED_NOT_CONFIRMED. + UnderconfirmedCheckpoints(ctx context.Context, in *QueryUnderconfirmedCheckpointsRequest, opts ...grpc.CallOption) (*QueryUnderconfirmedCheckpointsResponse, error) + // ConfirmedCheckpoints queries a list of checkpoints with the status of CONFIRMED. + ConfirmedCheckpoints(ctx context.Context, in *QueryConfirmedCheckpointsRequest, opts ...grpc.CallOption) (*QueryConfirmedCheckpointsResponse, error) + // BlsSigs queries a list of bls sigs of the validators at a given epoch number. + BlsSigs(ctx context.Context, in *QueryBlsSigsRequest, opts ...grpc.CallOption) (*QueryBlsSigsResponse, error) + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) RawCheckpoints(ctx context.Context, in *QueryRawCheckpointsRequest, opts ...grpc.CallOption) (*QueryRawCheckpointsResponse, error) { + out := new(QueryRawCheckpointsResponse) + err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/RawCheckpoints", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) RawCheckpoint(ctx context.Context, in *QueryRawCheckpointRequest, opts ...grpc.CallOption) (*QueryRawCheckpointResponse, error) { + out := new(QueryRawCheckpointResponse) + err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/RawCheckpoint", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) LatestCheckpoint(ctx context.Context, in *QueryLatestCheckpointRequest, opts ...grpc.CallOption) (*QueryLatestCheckpointResponse, error) { + out := new(QueryLatestCheckpointResponse) + err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/LatestCheckpoint", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) UncheckpointedCheckpoints(ctx context.Context, in *QueryUncheckpointedCheckpointsRequest, opts ...grpc.CallOption) (*QueryUncheckpointedCheckpointsResponse, error) { + out := new(QueryUncheckpointedCheckpointsResponse) + err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/UncheckpointedCheckpoints", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) UnderconfirmedCheckpoints(ctx context.Context, in *QueryUnderconfirmedCheckpointsRequest, opts ...grpc.CallOption) (*QueryUnderconfirmedCheckpointsResponse, error) { + out := new(QueryUnderconfirmedCheckpointsResponse) + err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/UnderconfirmedCheckpoints", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ConfirmedCheckpoints(ctx context.Context, in *QueryConfirmedCheckpointsRequest, opts ...grpc.CallOption) (*QueryConfirmedCheckpointsResponse, error) { + out := new(QueryConfirmedCheckpointsResponse) + err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/ConfirmedCheckpoints", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) BlsSigs(ctx context.Context, in *QueryBlsSigsRequest, opts ...grpc.CallOption) (*QueryBlsSigsResponse, error) { + out := new(QueryBlsSigsResponse) + err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/BlsSigs", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // RawCheckpoints queries a list of checkpoints starting from a given epoch number to the current epoch number. + RawCheckpoints(context.Context, *QueryRawCheckpointsRequest) (*QueryRawCheckpointsResponse, error) + // RawCheckpoint queries a checkpoints at a given epoch number. + RawCheckpoint(context.Context, *QueryRawCheckpointRequest) (*QueryRawCheckpointResponse, error) + // LatestCheckpoint queries the latest checkpoint. + LatestCheckpoint(context.Context, *QueryLatestCheckpointRequest) (*QueryLatestCheckpointResponse, error) + // UncheckpointedCheckpoints queries a list of checkpoints with the status of UNCHECKPOINTED. + UncheckpointedCheckpoints(context.Context, *QueryUncheckpointedCheckpointsRequest) (*QueryUncheckpointedCheckpointsResponse, error) + // UnderconfirmedCheckpoints queries a list of checkpoints with the status of CHECKPOINTED_NOT_CONFIRMED. + UnderconfirmedCheckpoints(context.Context, *QueryUnderconfirmedCheckpointsRequest) (*QueryUnderconfirmedCheckpointsResponse, error) + // ConfirmedCheckpoints queries a list of checkpoints with the status of CONFIRMED. + ConfirmedCheckpoints(context.Context, *QueryConfirmedCheckpointsRequest) (*QueryConfirmedCheckpointsResponse, error) + // BlsSigs queries a list of bls sigs of the validators at a given epoch number. + BlsSigs(context.Context, *QueryBlsSigsRequest) (*QueryBlsSigsResponse, error) + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) RawCheckpoints(ctx context.Context, req *QueryRawCheckpointsRequest) (*QueryRawCheckpointsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RawCheckpoints not implemented") +} +func (*UnimplementedQueryServer) RawCheckpoint(ctx context.Context, req *QueryRawCheckpointRequest) (*QueryRawCheckpointResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RawCheckpoint not implemented") +} +func (*UnimplementedQueryServer) LatestCheckpoint(ctx context.Context, req *QueryLatestCheckpointRequest) (*QueryLatestCheckpointResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LatestCheckpoint not implemented") +} +func (*UnimplementedQueryServer) UncheckpointedCheckpoints(ctx context.Context, req *QueryUncheckpointedCheckpointsRequest) (*QueryUncheckpointedCheckpointsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UncheckpointedCheckpoints not implemented") +} +func (*UnimplementedQueryServer) UnderconfirmedCheckpoints(ctx context.Context, req *QueryUnderconfirmedCheckpointsRequest) (*QueryUnderconfirmedCheckpointsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnderconfirmedCheckpoints not implemented") +} +func (*UnimplementedQueryServer) ConfirmedCheckpoints(ctx context.Context, req *QueryConfirmedCheckpointsRequest) (*QueryConfirmedCheckpointsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConfirmedCheckpoints not implemented") +} +func (*UnimplementedQueryServer) BlsSigs(ctx context.Context, req *QueryBlsSigsRequest) (*QueryBlsSigsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BlsSigs not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_RawCheckpoints_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRawCheckpointsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RawCheckpoints(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/babylon.checkpointing.v1.Query/RawCheckpoints", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RawCheckpoints(ctx, req.(*QueryRawCheckpointsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_RawCheckpoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRawCheckpointRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RawCheckpoint(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/babylon.checkpointing.v1.Query/RawCheckpoint", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RawCheckpoint(ctx, req.(*QueryRawCheckpointRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_LatestCheckpoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryLatestCheckpointRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).LatestCheckpoint(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/babylon.checkpointing.v1.Query/LatestCheckpoint", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).LatestCheckpoint(ctx, req.(*QueryLatestCheckpointRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_UncheckpointedCheckpoints_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryUncheckpointedCheckpointsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).UncheckpointedCheckpoints(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/babylon.checkpointing.v1.Query/UncheckpointedCheckpoints", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).UncheckpointedCheckpoints(ctx, req.(*QueryUncheckpointedCheckpointsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_UnderconfirmedCheckpoints_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryUnderconfirmedCheckpointsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).UnderconfirmedCheckpoints(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/babylon.checkpointing.v1.Query/UnderconfirmedCheckpoints", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).UnderconfirmedCheckpoints(ctx, req.(*QueryUnderconfirmedCheckpointsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ConfirmedCheckpoints_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryConfirmedCheckpointsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ConfirmedCheckpoints(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/babylon.checkpointing.v1.Query/ConfirmedCheckpoints", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ConfirmedCheckpoints(ctx, req.(*QueryConfirmedCheckpointsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_BlsSigs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBlsSigsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).BlsSigs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/babylon.checkpointing.v1.Query/BlsSigs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BlsSigs(ctx, req.(*QueryBlsSigsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +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: "/babylon.checkpointing.v1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "babylon.checkpointing.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RawCheckpoints", + Handler: _Query_RawCheckpoints_Handler, + }, + { + MethodName: "RawCheckpoint", + Handler: _Query_RawCheckpoint_Handler, + }, + { + MethodName: "LatestCheckpoint", + Handler: _Query_LatestCheckpoint_Handler, + }, + { + MethodName: "UncheckpointedCheckpoints", + Handler: _Query_UncheckpointedCheckpoints_Handler, + }, + { + MethodName: "UnderconfirmedCheckpoints", + Handler: _Query_UnderconfirmedCheckpoints_Handler, + }, + { + MethodName: "ConfirmedCheckpoints", + Handler: _Query_ConfirmedCheckpoints_Handler, + }, + { + MethodName: "BlsSigs", + Handler: _Query_BlsSigs_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "babylon/checkpointing/query.proto", +} + +func (m *QueryRawCheckpointsRequest) 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 *QueryRawCheckpointsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRawCheckpointsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.FromEpochNum != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.FromEpochNum)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryRawCheckpointsResponse) 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 *QueryRawCheckpointsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRawCheckpointsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.RawCheckpoints) > 0 { + for iNdEx := len(m.RawCheckpoints) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RawCheckpoints[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 (m *QueryRawCheckpointRequest) 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 *QueryRawCheckpointRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRawCheckpointRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.EpochNum != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.EpochNum)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryRawCheckpointResponse) 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 *QueryRawCheckpointResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRawCheckpointResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.RawCheckpoint != nil { + { + size, err := m.RawCheckpoint.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 *QueryLatestCheckpointRequest) 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 *QueryLatestCheckpointRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLatestCheckpointRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.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 *QueryLatestCheckpointResponse) 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 *QueryLatestCheckpointResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLatestCheckpointResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.LatestCheckpoint != nil { + { + size, err := m.LatestCheckpoint.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 *QueryUncheckpointedCheckpointsRequest) 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 *QueryUncheckpointedCheckpointsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUncheckpointedCheckpointsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.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 *QueryUncheckpointedCheckpointsResponse) 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 *QueryUncheckpointedCheckpointsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUncheckpointedCheckpointsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.UncheckpointedCheckpoint) > 0 { + for iNdEx := len(m.UncheckpointedCheckpoint) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.UncheckpointedCheckpoint[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 (m *QueryUnderconfirmedCheckpointsRequest) 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 *QueryUnderconfirmedCheckpointsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUnderconfirmedCheckpointsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.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 *QueryUnderconfirmedCheckpointsResponse) 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 *QueryUnderconfirmedCheckpointsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUnderconfirmedCheckpointsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.UnderconfirmedCheckpoint) > 0 { + for iNdEx := len(m.UnderconfirmedCheckpoint) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.UnderconfirmedCheckpoint[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 (m *QueryConfirmedCheckpointsRequest) 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 *QueryConfirmedCheckpointsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConfirmedCheckpointsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.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 *QueryConfirmedCheckpointsResponse) 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 *QueryConfirmedCheckpointsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConfirmedCheckpointsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.ConfirmedCheckpoint) > 0 { + for iNdEx := len(m.ConfirmedCheckpoint) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ConfirmedCheckpoint[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 (m *QueryBlsSigsRequest) 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 *QueryBlsSigsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBlsSigsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.EpochNum != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.EpochNum)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryBlsSigsResponse) 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 *QueryBlsSigsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBlsSigsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.BlsSigs) > 0 { + for iNdEx := len(m.BlsSigs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BlsSigs[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 (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryRawCheckpointsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.FromEpochNum != 0 { + n += 1 + sovQuery(uint64(m.FromEpochNum)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRawCheckpointsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.RawCheckpoints) > 0 { + for _, e := range m.RawCheckpoints { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRawCheckpointRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.EpochNum != 0 { + n += 1 + sovQuery(uint64(m.EpochNum)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRawCheckpointResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RawCheckpoint != nil { + l = m.RawCheckpoint.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryLatestCheckpointRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryLatestCheckpointResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.LatestCheckpoint != nil { + l = m.LatestCheckpoint.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryUncheckpointedCheckpointsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryUncheckpointedCheckpointsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.UncheckpointedCheckpoint) > 0 { + for _, e := range m.UncheckpointedCheckpoint { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryUnderconfirmedCheckpointsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryUnderconfirmedCheckpointsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.UnderconfirmedCheckpoint) > 0 { + for _, e := range m.UnderconfirmedCheckpoint { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryConfirmedCheckpointsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryConfirmedCheckpointsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ConfirmedCheckpoint) > 0 { + for _, e := range m.ConfirmedCheckpoint { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBlsSigsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.EpochNum != 0 { + n += 1 + sovQuery(uint64(m.EpochNum)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBlsSigsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.BlsSigs) > 0 { + for _, e := range m.BlsSigs { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryRawCheckpointsRequest) 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: QueryRawCheckpointsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRawCheckpointsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FromEpochNum", wireType) + } + m.FromEpochNum = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FromEpochNum |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryRawCheckpointsResponse) 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: QueryRawCheckpointsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRawCheckpointsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RawCheckpoints", 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.RawCheckpoints = append(m.RawCheckpoints, &RawCheckpoint{}) + if err := m.RawCheckpoints[len(m.RawCheckpoints)-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 Pagination", 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.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryRawCheckpointRequest) 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: QueryRawCheckpointRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRawCheckpointRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochNum", wireType) + } + m.EpochNum = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EpochNum |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryRawCheckpointResponse) 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: QueryRawCheckpointResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRawCheckpointResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RawCheckpoint", 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.RawCheckpoint == nil { + m.RawCheckpoint = &RawCheckpoint{} + } + if err := m.RawCheckpoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryLatestCheckpointRequest) 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: QueryLatestCheckpointRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLatestCheckpointRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryLatestCheckpointResponse) 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: QueryLatestCheckpointResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLatestCheckpointResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestCheckpoint", 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.LatestCheckpoint == nil { + m.LatestCheckpoint = &RawCheckpoint{} + } + if err := m.LatestCheckpoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryUncheckpointedCheckpointsRequest) 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: QueryUncheckpointedCheckpointsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUncheckpointedCheckpointsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryUncheckpointedCheckpointsResponse) 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: QueryUncheckpointedCheckpointsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUncheckpointedCheckpointsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UncheckpointedCheckpoint", 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.UncheckpointedCheckpoint = append(m.UncheckpointedCheckpoint, &RawCheckpoint{}) + if err := m.UncheckpointedCheckpoint[len(m.UncheckpointedCheckpoint)-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 Pagination", 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.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryUnderconfirmedCheckpointsRequest) 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: QueryUnderconfirmedCheckpointsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUnderconfirmedCheckpointsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryUnderconfirmedCheckpointsResponse) 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: QueryUnderconfirmedCheckpointsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUnderconfirmedCheckpointsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnderconfirmedCheckpoint", 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.UnderconfirmedCheckpoint = append(m.UnderconfirmedCheckpoint, &RawCheckpoint{}) + if err := m.UnderconfirmedCheckpoint[len(m.UnderconfirmedCheckpoint)-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 Pagination", 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.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryConfirmedCheckpointsRequest) 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: QueryConfirmedCheckpointsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConfirmedCheckpointsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy } - 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 *QueryRawCheckpointsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BottomEpoch != 0 { - n += 1 + sovQuery(uint64(m.BottomEpoch)) - } - if m.TopEpoch != 0 { - n += 1 + sovQuery(uint64(m.TopEpoch)) + if iNdEx > l { + return io.ErrUnexpectedEOF } - return n + return nil } - -func (m *QueryRawCheckpointsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.RawCheckpoints) > 0 { - for _, e := range m.RawCheckpoints { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryConfirmedCheckpointsResponse) 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: QueryConfirmedCheckpointsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConfirmedCheckpointsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConfirmedCheckpoint", 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.ConfirmedCheckpoint = append(m.ConfirmedCheckpoint, &RawCheckpoint{}) + if err := m.ConfirmedCheckpoint[len(m.ConfirmedCheckpoint)-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 Pagination", 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.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy } } - return n -} - -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 + if iNdEx > l { + return io.ErrUnexpectedEOF } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return nil } -func (m *QueryRawCheckpointsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryBlsSigsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -587,17 +3508,17 @@ func (m *QueryRawCheckpointsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryRawCheckpointsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBlsSigsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRawCheckpointsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryBlsSigsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BottomEpoch", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field EpochNum", wireType) } - m.BottomEpoch = 0 + m.EpochNum = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -607,16 +3528,16 @@ func (m *QueryRawCheckpointsRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.BottomEpoch |= int64(b&0x7F) << shift + m.EpochNum |= int64(b&0x7F) << shift if b < 0x80 { break } } case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TopEpoch", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - m.TopEpoch = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -626,11 +3547,28 @@ func (m *QueryRawCheckpointsRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TopEpoch |= int64(b&0x7F) << shift + 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.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -652,7 +3590,7 @@ func (m *QueryRawCheckpointsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryRawCheckpointsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryBlsSigsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -675,15 +3613,15 @@ func (m *QueryRawCheckpointsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryRawCheckpointsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBlsSigsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRawCheckpointsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryBlsSigsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RawCheckpoints", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BlsSigs", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -710,8 +3648,44 @@ func (m *QueryRawCheckpointsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RawCheckpoints = append(m.RawCheckpoints, &RawCheckpoint{}) - if err := m.RawCheckpoints[len(m.RawCheckpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.BlsSigs = append(m.BlsSigs, &BlsSig{}) + if err := m.BlsSigs[len(m.BlsSigs)-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 Pagination", 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.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/checkpointing/types/query.pb.gw.go b/x/checkpointing/types/query.pb.gw.go index 3ac347dcc..5a1199f96 100644 --- a/x/checkpointing/types/query.pb.gw.go +++ b/x/checkpointing/types/query.pb.gw.go @@ -20,7 +20,6 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -31,7 +30,366 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage -var _ = metadata.Join + +var ( + filter_Query_RawCheckpoints_0 = &utilities.DoubleArray{Encoding: map[string]int{"from_epoch_num": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_RawCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRawCheckpointsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["from_epoch_num"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "from_epoch_num") + } + + protoReq.FromEpochNum, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "from_epoch_num", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RawCheckpoints_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RawCheckpoints(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_RawCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRawCheckpointsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["from_epoch_num"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "from_epoch_num") + } + + protoReq.FromEpochNum, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "from_epoch_num", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RawCheckpoints_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RawCheckpoints(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_RawCheckpoint_0 = &utilities.DoubleArray{Encoding: map[string]int{"epoch_num": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_RawCheckpoint_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRawCheckpointRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["epoch_num"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_num") + } + + protoReq.EpochNum, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_num", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RawCheckpoint_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RawCheckpoint(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_RawCheckpoint_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRawCheckpointRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["epoch_num"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_num") + } + + protoReq.EpochNum, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_num", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RawCheckpoint_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RawCheckpoint(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_LatestCheckpoint_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_LatestCheckpoint_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLatestCheckpointRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LatestCheckpoint_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.LatestCheckpoint(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_LatestCheckpoint_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLatestCheckpointRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LatestCheckpoint_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.LatestCheckpoint(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_UncheckpointedCheckpoints_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_UncheckpointedCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUncheckpointedCheckpointsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_UncheckpointedCheckpoints_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UncheckpointedCheckpoints(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_UncheckpointedCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUncheckpointedCheckpointsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_UncheckpointedCheckpoints_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.UncheckpointedCheckpoints(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_UnderconfirmedCheckpoints_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_UnderconfirmedCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUnderconfirmedCheckpointsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_UnderconfirmedCheckpoints_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UnderconfirmedCheckpoints(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_UnderconfirmedCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUnderconfirmedCheckpointsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_UnderconfirmedCheckpoints_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.UnderconfirmedCheckpoints(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_ConfirmedCheckpoints_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_ConfirmedCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConfirmedCheckpointsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ConfirmedCheckpoints_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ConfirmedCheckpoints(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ConfirmedCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConfirmedCheckpointsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ConfirmedCheckpoints_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ConfirmedCheckpoints(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_BlsSigs_0 = &utilities.DoubleArray{Encoding: map[string]int{"epoch_num": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_BlsSigs_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBlsSigsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["epoch_num"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_num") + } + + protoReq.EpochNum, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_num", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BlsSigs_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.BlsSigs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_BlsSigs_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBlsSigsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["epoch_num"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_num") + } + + protoReq.EpochNum, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_num", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BlsSigs_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.BlsSigs(ctx, &protoReq) + return msg, metadata, err + +} func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryParamsRequest @@ -54,14 +412,152 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + mux.Handle("GET", pattern_Query_RawCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_RawCheckpoints_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RawCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RawCheckpoint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_RawCheckpoint_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RawCheckpoint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LatestCheckpoint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_LatestCheckpoint_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_LatestCheckpoint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_UncheckpointedCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_UncheckpointedCheckpoints_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_UncheckpointedCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_UnderconfirmedCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_UnderconfirmedCheckpoints_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_UnderconfirmedCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ConfirmedCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ConfirmedCheckpoints_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ConfirmedCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BlsSigs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_BlsSigs_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BlsSigs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -69,7 +565,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -121,6 +616,146 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + mux.Handle("GET", pattern_Query_RawCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_RawCheckpoints_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RawCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RawCheckpoint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_RawCheckpoint_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RawCheckpoint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LatestCheckpoint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_LatestCheckpoint_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_LatestCheckpoint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_UncheckpointedCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_UncheckpointedCheckpoints_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_UncheckpointedCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_UnderconfirmedCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_UnderconfirmedCheckpoints_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_UnderconfirmedCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ConfirmedCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_ConfirmedCheckpoints_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ConfirmedCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BlsSigs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_BlsSigs_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BlsSigs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -145,9 +780,37 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylonchain", "babylon", "checkpointing", "params"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_RawCheckpoints_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "checkpointing", "v1", "raw_checkpoints", "from_epoch_num"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_RawCheckpoint_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "checkpointing", "v1", "raw_checkpoint", "epoch_num"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_LatestCheckpoint_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "checkpointing", "v1", "latest_checkpoint"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_UncheckpointedCheckpoints_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "checkpointing", "v1", "uncheckpointed_checkpoints"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_UnderconfirmedCheckpoints_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "checkpointing", "v1", "underconfirmed_checkpoints"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_ConfirmedCheckpoints_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "checkpointing", "v1", "confirmed_checkpoints"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_BlsSigs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "checkpointing", "v1", "bls_sigs", "epoch_num"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "checkpointing", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( + forward_Query_RawCheckpoints_0 = runtime.ForwardResponseMessage + + forward_Query_RawCheckpoint_0 = runtime.ForwardResponseMessage + + forward_Query_LatestCheckpoint_0 = runtime.ForwardResponseMessage + + forward_Query_UncheckpointedCheckpoints_0 = runtime.ForwardResponseMessage + + forward_Query_UnderconfirmedCheckpoints_0 = runtime.ForwardResponseMessage + + forward_Query_ConfirmedCheckpoints_0 = runtime.ForwardResponseMessage + + forward_Query_BlsSigs_0 = runtime.ForwardResponseMessage + forward_Query_Params_0 = runtime.ForwardResponseMessage ) diff --git a/x/checkpointing/types/tx.pb.go b/x/checkpointing/types/tx.pb.go index c4c9d5bfa..908a59b13 100644 --- a/x/checkpointing/types/tx.pb.go +++ b/x/checkpointing/types/tx.pb.go @@ -28,24 +28,24 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgCollectBlsSig defines a message to collect a bls signature from a +// MsgAddBlsSig defines a message to add a bls signature from a // validator -type MsgCollectBlsSig struct { +type MsgAddBlsSig struct { BlsSig *BlsSig `protobuf:"bytes,1,opt,name=bls_sig,json=blsSig,proto3" json:"bls_sig,omitempty"` } -func (m *MsgCollectBlsSig) Reset() { *m = MsgCollectBlsSig{} } -func (m *MsgCollectBlsSig) String() string { return proto.CompactTextString(m) } -func (*MsgCollectBlsSig) ProtoMessage() {} -func (*MsgCollectBlsSig) Descriptor() ([]byte, []int) { +func (m *MsgAddBlsSig) Reset() { *m = MsgAddBlsSig{} } +func (m *MsgAddBlsSig) String() string { return proto.CompactTextString(m) } +func (*MsgAddBlsSig) ProtoMessage() {} +func (*MsgAddBlsSig) Descriptor() ([]byte, []int) { return fileDescriptor_24b023a97b92daa6, []int{0} } -func (m *MsgCollectBlsSig) XXX_Unmarshal(b []byte) error { +func (m *MsgAddBlsSig) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgCollectBlsSig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgAddBlsSig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgCollectBlsSig.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgAddBlsSig.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -55,34 +55,34 @@ func (m *MsgCollectBlsSig) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } -func (m *MsgCollectBlsSig) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCollectBlsSig.Merge(m, src) +func (m *MsgAddBlsSig) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddBlsSig.Merge(m, src) } -func (m *MsgCollectBlsSig) XXX_Size() int { +func (m *MsgAddBlsSig) XXX_Size() int { return m.Size() } -func (m *MsgCollectBlsSig) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCollectBlsSig.DiscardUnknown(m) +func (m *MsgAddBlsSig) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddBlsSig.DiscardUnknown(m) } -var xxx_messageInfo_MsgCollectBlsSig proto.InternalMessageInfo +var xxx_messageInfo_MsgAddBlsSig proto.InternalMessageInfo -// MsgCollectBlsSigResponse defines the MsgCollectBlsSig response type. -type MsgCollectBlsSigResponse struct { +// MsgAddBlsSigResponse defines the MsgAddBlsSig response type. +type MsgAddBlsSigResponse struct { } -func (m *MsgCollectBlsSigResponse) Reset() { *m = MsgCollectBlsSigResponse{} } -func (m *MsgCollectBlsSigResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCollectBlsSigResponse) ProtoMessage() {} -func (*MsgCollectBlsSigResponse) Descriptor() ([]byte, []int) { +func (m *MsgAddBlsSigResponse) Reset() { *m = MsgAddBlsSigResponse{} } +func (m *MsgAddBlsSigResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAddBlsSigResponse) ProtoMessage() {} +func (*MsgAddBlsSigResponse) Descriptor() ([]byte, []int) { return fileDescriptor_24b023a97b92daa6, []int{1} } -func (m *MsgCollectBlsSigResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgAddBlsSigResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgCollectBlsSigResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgAddBlsSigResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgCollectBlsSigResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgAddBlsSigResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -92,43 +92,43 @@ func (m *MsgCollectBlsSigResponse) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } -func (m *MsgCollectBlsSigResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCollectBlsSigResponse.Merge(m, src) +func (m *MsgAddBlsSigResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddBlsSigResponse.Merge(m, src) } -func (m *MsgCollectBlsSigResponse) XXX_Size() int { +func (m *MsgAddBlsSigResponse) XXX_Size() int { return m.Size() } -func (m *MsgCollectBlsSigResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCollectBlsSigResponse.DiscardUnknown(m) +func (m *MsgAddBlsSigResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddBlsSigResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgCollectBlsSigResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgAddBlsSigResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgCollectBlsSig)(nil), "babylon.checkpointing.v1.MsgCollectBlsSig") - proto.RegisterType((*MsgCollectBlsSigResponse)(nil), "babylon.checkpointing.v1.MsgCollectBlsSigResponse") + proto.RegisterType((*MsgAddBlsSig)(nil), "babylon.checkpointing.v1.MsgAddBlsSig") + proto.RegisterType((*MsgAddBlsSigResponse)(nil), "babylon.checkpointing.v1.MsgAddBlsSigResponse") } func init() { proto.RegisterFile("babylon/checkpointing/tx.proto", fileDescriptor_24b023a97b92daa6) } var fileDescriptor_24b023a97b92daa6 = []byte{ - // 255 bytes of a gzipped FileDescriptorProto + // 246 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0x4a, 0x4c, 0xaa, 0xcc, 0xc9, 0xcf, 0xd3, 0x4f, 0xce, 0x48, 0x4d, 0xce, 0x2e, 0xc8, 0xcf, 0xcc, 0x2b, 0xc9, 0xcc, 0x4b, 0xd7, 0x2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0x5c, 0x7d, 0xa8, 0xb9, 0xc9, 0x19, 0x89, - 0x99, 0x79, 0x30, 0x8e, 0x7e, 0x05, 0x7a, 0xac, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x03, - 0xd1, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x37, 0xb8, 0x55, 0xc2, 0xbb, 0x01, 0x00, 0x00, + 0xf5, 0x52, 0x6a, 0xd8, 0xcd, 0x43, 0xf0, 0x20, 0xea, 0x94, 0x82, 0xb9, 0x78, 0x7c, 0x8b, 0xd3, + 0x1d, 0x53, 0x52, 0x9c, 0x72, 0x8a, 0x83, 0x33, 0xd3, 0x85, 0x2c, 0xb9, 0xd8, 0x93, 0x72, 0x8a, + 0xe3, 0x8b, 0x33, 0xd3, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x14, 0xf4, 0x70, 0xd9, 0xac, + 0x07, 0xd1, 0x12, 0xc4, 0x96, 0x04, 0xa6, 0xad, 0x38, 0x3a, 0x16, 0xc8, 0x33, 0xbc, 0x58, 0x20, + 0xcf, 0xa0, 0x24, 0xc6, 0x25, 0x82, 0x6c, 0x68, 0x50, 0x6a, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, + 0x51, 0x16, 0x17, 0xb3, 0x6f, 0x71, 0xba, 0x50, 0x32, 0x17, 0x27, 0xc2, 0x42, 0x35, 0xdc, 0xe6, + 0x23, 0x9b, 0x21, 0xa5, 0x47, 0x9c, 0x3a, 0x98, 0x5d, 0x4e, 0xfe, 0x27, 0x1e, 0xc9, 0x31, 0x5e, + 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, + 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x9a, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, + 0xab, 0x0f, 0x35, 0x33, 0x39, 0x23, 0x31, 0x33, 0x0f, 0xc6, 0xd1, 0xaf, 0x40, 0x8f, 0x84, 0xca, + 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0x80, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x32, 0xaf, + 0xd1, 0xd8, 0xaa, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -143,7 +143,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 MsgClient interface { - CollectBlsSig(ctx context.Context, in *MsgCollectBlsSig, opts ...grpc.CallOption) (*MsgCollectBlsSigResponse, error) + AddBlsSig(ctx context.Context, in *MsgAddBlsSig, opts ...grpc.CallOption) (*MsgAddBlsSigResponse, error) } type msgClient struct { @@ -154,9 +154,9 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) CollectBlsSig(ctx context.Context, in *MsgCollectBlsSig, opts ...grpc.CallOption) (*MsgCollectBlsSigResponse, error) { - out := new(MsgCollectBlsSigResponse) - err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Msg/CollectBlsSig", in, out, opts...) +func (c *msgClient) AddBlsSig(ctx context.Context, in *MsgAddBlsSig, opts ...grpc.CallOption) (*MsgAddBlsSigResponse, error) { + out := new(MsgAddBlsSigResponse) + err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Msg/AddBlsSig", in, out, opts...) if err != nil { return nil, err } @@ -165,35 +165,35 @@ func (c *msgClient) CollectBlsSig(ctx context.Context, in *MsgCollectBlsSig, opt // MsgServer is the server API for Msg service. type MsgServer interface { - CollectBlsSig(context.Context, *MsgCollectBlsSig) (*MsgCollectBlsSigResponse, error) + AddBlsSig(context.Context, *MsgAddBlsSig) (*MsgAddBlsSigResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) CollectBlsSig(ctx context.Context, req *MsgCollectBlsSig) (*MsgCollectBlsSigResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CollectBlsSig not implemented") +func (*UnimplementedMsgServer) AddBlsSig(ctx context.Context, req *MsgAddBlsSig) (*MsgAddBlsSigResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddBlsSig not implemented") } func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_CollectBlsSig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCollectBlsSig) +func _Msg_AddBlsSig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAddBlsSig) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).CollectBlsSig(ctx, in) + return srv.(MsgServer).AddBlsSig(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/babylon.checkpointing.v1.Msg/CollectBlsSig", + FullMethod: "/babylon.checkpointing.v1.Msg/AddBlsSig", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CollectBlsSig(ctx, req.(*MsgCollectBlsSig)) + return srv.(MsgServer).AddBlsSig(ctx, req.(*MsgAddBlsSig)) } return interceptor(ctx, in, info, handler) } @@ -203,15 +203,15 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "CollectBlsSig", - Handler: _Msg_CollectBlsSig_Handler, + MethodName: "AddBlsSig", + Handler: _Msg_AddBlsSig_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "babylon/checkpointing/tx.proto", } -func (m *MsgCollectBlsSig) Marshal() (dAtA []byte, err error) { +func (m *MsgAddBlsSig) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -221,12 +221,12 @@ func (m *MsgCollectBlsSig) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgCollectBlsSig) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgAddBlsSig) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgCollectBlsSig) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgAddBlsSig) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -246,7 +246,7 @@ func (m *MsgCollectBlsSig) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgCollectBlsSigResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgAddBlsSigResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -256,12 +256,12 @@ func (m *MsgCollectBlsSigResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgCollectBlsSigResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgAddBlsSigResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgCollectBlsSigResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgAddBlsSigResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -280,7 +280,7 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgCollectBlsSig) Size() (n int) { +func (m *MsgAddBlsSig) Size() (n int) { if m == nil { return 0 } @@ -293,7 +293,7 @@ func (m *MsgCollectBlsSig) Size() (n int) { return n } -func (m *MsgCollectBlsSigResponse) Size() (n int) { +func (m *MsgAddBlsSigResponse) Size() (n int) { if m == nil { return 0 } @@ -308,7 +308,7 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgCollectBlsSig) Unmarshal(dAtA []byte) error { +func (m *MsgAddBlsSig) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -331,10 +331,10 @@ func (m *MsgCollectBlsSig) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCollectBlsSig: wiretype end group for non-group") + return fmt.Errorf("proto: MsgAddBlsSig: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCollectBlsSig: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgAddBlsSig: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -394,7 +394,7 @@ func (m *MsgCollectBlsSig) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCollectBlsSigResponse) Unmarshal(dAtA []byte) error { +func (m *MsgAddBlsSigResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -417,10 +417,10 @@ func (m *MsgCollectBlsSigResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCollectBlsSigResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgAddBlsSigResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCollectBlsSigResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgAddBlsSigResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: From 8f106294a4f8bfc1a358a16df8f87e78f88a5529 Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Mon, 13 Jun 2022 00:18:59 +0800 Subject: [PATCH 03/16] fixed minor protobuf issues --- proto/babylon/checkpointing/checkpoint.proto | 7 +- proto/babylon/checkpointing/query.proto | 24 +- x/checkpointing/types/checkpoint.pb.go | 134 ++----- x/checkpointing/types/query.pb.go | 378 ++++--------------- x/checkpointing/types/query.pb.gw.go | 48 +-- 5 files changed, 122 insertions(+), 469 deletions(-) diff --git a/proto/babylon/checkpointing/checkpoint.proto b/proto/babylon/checkpointing/checkpoint.proto index fec2a7c38..1cdac4f76 100644 --- a/proto/babylon/checkpointing/checkpoint.proto +++ b/proto/babylon/checkpointing/checkpoint.proto @@ -13,7 +13,7 @@ message RawCheckpoint { option (gogoproto.goproto_stringer) = false; // epoch_num defines the epoch number the raw checkpoint is for - int64 epoch_num = 1; + uint64 epoch_num = 1; // last_commit_hash defines the 'LastCommitHash' that individual bls sigs are signed on bytes last_commit_hash = 2; // bitmap defines the bitmap that indicates the signers of the bls multi sig @@ -34,13 +34,12 @@ message RawCheckpoint { // BlsSig wraps the bls sig with meta data. message BlsSig { // epoch_num defines the epoch number that the bls sig is signed on - int64 epoch_num = 1; + uint64 epoch_num = 1; // last_commit_hash defines the 'LastCommitHash' that the bls sig is signed on bytes last_commit_hash = 2; // bls_sig defines the actual bls sig bytes bls_sig = 3; - google.protobuf.Timestamp time = 4; - // can't find cosmos_proto.scalar when compiling + // can't find cosmos_proto.scalar when compiling due to cosmos v0.45.4 does not support scalar // string signer_address = 5 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // the signer_address defines the address of the signer string signer_address = 5; diff --git a/proto/babylon/checkpointing/query.proto b/proto/babylon/checkpointing/query.proto index 9529bf758..c71290ce6 100644 --- a/proto/babylon/checkpointing/query.proto +++ b/proto/babylon/checkpointing/query.proto @@ -56,7 +56,7 @@ service Query { // RPC method. message QueryRawCheckpointsRequest { // from_epoch defines the start epoch of the query, which is inclusive - int64 from_epoch_num = 1; + uint64 from_epoch_num = 1; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; @@ -65,6 +65,7 @@ message QueryRawCheckpointsRequest { // QueryRawCheckpointsResponse is the response type for the Query/RawCheckpoints // RPC method. message QueryRawCheckpointsResponse { + // the order is going from the newest to oldest based on the epoch number repeated RawCheckpoint raw_checkpoints = 1; // pagination defines the pagination in the response. @@ -75,35 +76,23 @@ message QueryRawCheckpointsResponse { // RPC method. message QueryRawCheckpointRequest { // epoch_num defines the epoch for the queried checkpoint - int64 epoch_num = 1; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; + uint64 epoch_num = 1; } // QueryRawCheckpointResponse is the response type for the Query/RawCheckpoint // RPC method. message QueryRawCheckpointResponse { RawCheckpoint raw_checkpoint = 1; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; } // QueryLatestCheckpointRequest is the request type for the Query/LatestCheckpoint // RPC method. -message QueryLatestCheckpointRequest { - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} +message QueryLatestCheckpointRequest {} // QueryLatestCheckpointResponse is the response type for the Query/LatestCheckpoint // RPC method. message QueryLatestCheckpointResponse { RawCheckpoint latest_checkpoint = 1; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; } // QueryUncheckpointedCheckpointsRequest is the request type for the Query/UncheckpointedCheckpoints @@ -116,6 +105,7 @@ message QueryUncheckpointedCheckpointsRequest { // QueryUncheckpointedCheckpointsResponse is the response type for the Query/UncheckpointedCheckpoints // RPC method. message QueryUncheckpointedCheckpointsResponse { + // the order is going from the newest to oldest based on the epoch number repeated RawCheckpoint uncheckpointed_checkpoint = 1; // pagination defines the pagination in the response. @@ -132,6 +122,7 @@ message QueryUnderconfirmedCheckpointsRequest { // QueryUnderconfirmedCheckpointsResponse is the response type for the Query/UnderconfirmedCheckpoints // RPC method. message QueryUnderconfirmedCheckpointsResponse { + // the order is going from the newest to oldest based on the epoch number repeated RawCheckpoint underconfirmed_checkpoint = 1; // pagination defines the pagination in the response. @@ -148,6 +139,7 @@ message QueryConfirmedCheckpointsRequest { // QueryConfirmedCheckpointsResponse is the response type for the Query/ConfirmedCheckpoints // RPC method. message QueryConfirmedCheckpointsResponse { + // the order is going from the newest to oldest based on the epoch number repeated RawCheckpoint confirmed_checkpoint = 1; // pagination defines the pagination in the response. @@ -158,7 +150,7 @@ message QueryConfirmedCheckpointsResponse { // RPC method. message QueryBlsSigsRequest { // epoch_num defines the epoch for the queried bls sigs - int64 epoch_num = 1; + uint64 epoch_num = 1; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; } diff --git a/x/checkpointing/types/checkpoint.pb.go b/x/checkpointing/types/checkpoint.pb.go index 806e2461c..02efd575c 100644 --- a/x/checkpointing/types/checkpoint.pb.go +++ b/x/checkpointing/types/checkpoint.pb.go @@ -9,7 +9,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" _ "github.com/regen-network/cosmos-proto" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" + _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" @@ -61,7 +61,7 @@ func (RawCheckpoint_Status) EnumDescriptor() ([]byte, []int) { // RawCheckpoint wraps the multi sig with meta data. type RawCheckpoint struct { // epoch_num defines the epoch number the raw checkpoint is for - EpochNum int64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` + EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` // last_commit_hash defines the 'LastCommitHash' that individual bls sigs are signed on LastCommitHash []byte `protobuf:"bytes,2,opt,name=last_commit_hash,json=lastCommitHash,proto3" json:"last_commit_hash,omitempty"` // bitmap defines the bitmap that indicates the signers of the bls multi sig @@ -102,7 +102,7 @@ func (m *RawCheckpoint) XXX_DiscardUnknown() { var xxx_messageInfo_RawCheckpoint proto.InternalMessageInfo -func (m *RawCheckpoint) GetEpochNum() int64 { +func (m *RawCheckpoint) GetEpochNum() uint64 { if m != nil { return m.EpochNum } @@ -133,13 +133,12 @@ func (m *RawCheckpoint) GetBlsMultiSig() []byte { // BlsSig wraps the bls sig with meta data. type BlsSig struct { // epoch_num defines the epoch number that the bls sig is signed on - EpochNum int64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` + EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` // last_commit_hash defines the 'LastCommitHash' that the bls sig is signed on LastCommitHash []byte `protobuf:"bytes,2,opt,name=last_commit_hash,json=lastCommitHash,proto3" json:"last_commit_hash,omitempty"` // bls_sig defines the actual bls sig - BlsSig []byte `protobuf:"bytes,3,opt,name=bls_sig,json=blsSig,proto3" json:"bls_sig,omitempty"` - Time *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=time,proto3" json:"time,omitempty"` - // can't find cosmos_proto.scalar when compiling + BlsSig []byte `protobuf:"bytes,3,opt,name=bls_sig,json=blsSig,proto3" json:"bls_sig,omitempty"` + // can't find cosmos_proto.scalar when compiling due to cosmos v0.45.4 does not support scalar // string signer_address = 5 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // the signer_address defines the address of the signer SignerAddress string `protobuf:"bytes,5,opt,name=signer_address,json=signerAddress,proto3" json:"signer_address,omitempty"` @@ -178,7 +177,7 @@ func (m *BlsSig) XXX_DiscardUnknown() { var xxx_messageInfo_BlsSig proto.InternalMessageInfo -func (m *BlsSig) GetEpochNum() int64 { +func (m *BlsSig) GetEpochNum() uint64 { if m != nil { return m.EpochNum } @@ -199,13 +198,6 @@ func (m *BlsSig) GetBlsSig() []byte { return nil } -func (m *BlsSig) GetTime() *timestamppb.Timestamp { - if m != nil { - return m.Time - } - return nil -} - func (m *BlsSig) GetSignerAddress() string { if m != nil { return m.SignerAddress @@ -224,35 +216,33 @@ func init() { } var fileDescriptor_63ff05f0a47b36f7 = []byte{ - // 435 bytes of a gzipped FileDescriptorProto -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0xe9, 0x39, 0xfa, 0xd2, - 0xc1, 0xc3, 0xf9, 0xb7, 0x75, 0x00, 0xae, 0xd6, 0x01, 0xf8, 0xb1, 0x0e, 0xc0, 0xe7, 0x4d, 0xe0, - 0x5d, 0x6d, 0x02, 0xef, 0xfb, 0x26, 0xf0, 0xde, 0x3e, 0xe7, 0xc2, 0xe4, 0x35, 0xc3, 0xa9, 0x92, - 0xe1, 0x76, 0x7c, 0xd2, 0x9c, 0x8a, 0xb2, 0x15, 0xe1, 0xa7, 0xff, 0xa6, 0xce, 0x5c, 0x54, 0x99, - 0x66, 0x1d, 0xfb, 0xa2, 0x67, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x21, 0x6a, 0x96, 0x56, 0x9b, - 0x02, 0x00, 0x00, + // 411 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0x3f, 0x8f, 0xd3, 0x30, + 0x18, 0xc6, 0xe3, 0xe3, 0x08, 0x57, 0x43, 0xaa, 0xca, 0x42, 0x10, 0x8a, 0x94, 0x56, 0x91, 0x40, + 0x99, 0x12, 0x21, 0xc4, 0xc2, 0xc6, 0xe5, 0x8a, 0xee, 0x74, 0xba, 0x04, 0xa5, 0xc7, 0xc2, 0x62, + 0xd9, 0x69, 0x70, 0x2c, 0xe2, 0x38, 0xaa, 0x1d, 0xa0, 0x9f, 0x02, 0x46, 0xc6, 0x7e, 0x1c, 0xc6, + 0x8e, 0x8c, 0xa8, 0x5d, 0xe0, 0x5b, 0xa0, 0xfc, 0x29, 0x14, 0x66, 0xb6, 0xfc, 0x7e, 0xef, 0x13, + 0x5b, 0x8f, 0xfc, 0xc2, 0xc7, 0x94, 0xd0, 0x55, 0x21, 0xcb, 0x20, 0xcd, 0xb3, 0xf4, 0x5d, 0x25, + 0x79, 0xa9, 0x79, 0xc9, 0x0e, 0xc8, 0xaf, 0x96, 0x52, 0x4b, 0x64, 0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0xd1, 0xf3, 0x93, 0x2f, 0xeb, 0x89, 0xf1, 0x63, 0x3d, 0x01, 0xee, 0x27, 0x00, 0xcd, + 0xd3, 0x42, 0xcd, 0x39, 0xfb, 0x5f, 0x25, 0xef, 0xc3, 0x5b, 0x4d, 0x99, 0xa6, 0xc6, 0xbe, 0x65, + 0x77, 0xfe, 0x23, 0x38, 0x54, 0x9c, 0x95, 0xd9, 0x12, 0x93, 0xc5, 0x62, 0x99, 0x29, 0x65, 0xdf, + 0x9c, 0x02, 0x6f, 0x90, 0x58, 0x9d, 0x7d, 0xd1, 0xc9, 0xd3, 0xf8, 0xeb, 0xd6, 0x01, 0x9b, 0xad, + 0x03, 0xbe, 0x6f, 0x1d, 0xf0, 0x79, 0xe7, 0x18, 0x9b, 0x9d, 0x63, 0x7c, 0xdb, 0x39, 0xc6, 0x9b, + 0x67, 0x8c, 0xeb, 0xbc, 0xa6, 0x7e, 0x2a, 0x45, 0xd0, 0xaf, 0x43, 0x9a, 0x13, 0x5e, 0xee, 0x21, + 0xf8, 0xf8, 0xcf, 0x16, 0xe9, 0x55, 0x95, 0x29, 0x6a, 0xb6, 0xaf, 0xfa, 0xf4, 0x57, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x05, 0xaa, 0xcd, 0x08, 0x6b, 0x02, 0x00, 0x00, } func (this *RawCheckpoint) Equal(that interface{}) bool { @@ -364,18 +354,6 @@ func (m *BlsSig) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x2a } - if m.Time != nil { - { - size, err := m.Time.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCheckpoint(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } if len(m.BlsSig) > 0 { i -= len(m.BlsSig) copy(dAtA[i:], m.BlsSig) @@ -450,10 +428,6 @@ func (m *BlsSig) Size() (n int) { if l > 0 { n += 1 + l + sovCheckpoint(uint64(l)) } - if m.Time != nil { - l = m.Time.Size() - n += 1 + l + sovCheckpoint(uint64(l)) - } l = len(m.SignerAddress) if l > 0 { n += 1 + l + sovCheckpoint(uint64(l)) @@ -510,7 +484,7 @@ func (m *RawCheckpoint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.EpochNum |= int64(b&0x7F) << shift + m.EpochNum |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -681,7 +655,7 @@ func (m *BlsSig) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.EpochNum |= int64(b&0x7F) << shift + m.EpochNum |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -754,42 +728,6 @@ func (m *BlsSig) Unmarshal(dAtA []byte) error { m.BlsSig = []byte{} } iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCheckpoint - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCheckpoint - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCheckpoint - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Time == nil { - m.Time = ×tamppb.Timestamp{} - } - if err := m.Time.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SignerAddress", wireType) diff --git a/x/checkpointing/types/query.pb.go b/x/checkpointing/types/query.pb.go index 06d2a1f56..cb4fa1177 100644 --- a/x/checkpointing/types/query.pb.go +++ b/x/checkpointing/types/query.pb.go @@ -34,7 +34,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // RPC method. type QueryRawCheckpointsRequest struct { // from_epoch defines the start epoch of the query, which is inclusive - FromEpochNum int64 `protobuf:"varint,1,opt,name=from_epoch_num,json=fromEpochNum,proto3" json:"from_epoch_num,omitempty"` + FromEpochNum uint64 `protobuf:"varint,1,opt,name=from_epoch_num,json=fromEpochNum,proto3" json:"from_epoch_num,omitempty"` // pagination defines an optional pagination for the request. Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -72,7 +72,7 @@ func (m *QueryRawCheckpointsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryRawCheckpointsRequest proto.InternalMessageInfo -func (m *QueryRawCheckpointsRequest) GetFromEpochNum() int64 { +func (m *QueryRawCheckpointsRequest) GetFromEpochNum() uint64 { if m != nil { return m.FromEpochNum } @@ -89,6 +89,7 @@ func (m *QueryRawCheckpointsRequest) GetPagination() *query.PageRequest { // QueryRawCheckpointsResponse is the response type for the Query/RawCheckpoints // RPC method. type QueryRawCheckpointsResponse struct { + // the order is going from the newest to oldest based on the epoch number RawCheckpoints []*RawCheckpoint `protobuf:"bytes,1,rep,name=raw_checkpoints,json=rawCheckpoints,proto3" json:"raw_checkpoints,omitempty"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` @@ -145,9 +146,7 @@ func (m *QueryRawCheckpointsResponse) GetPagination() *query.PageResponse { // RPC method. type QueryRawCheckpointRequest struct { // epoch_num defines the epoch for the queried checkpoint - EpochNum int64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` + EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` } func (m *QueryRawCheckpointRequest) Reset() { *m = QueryRawCheckpointRequest{} } @@ -183,26 +182,17 @@ func (m *QueryRawCheckpointRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryRawCheckpointRequest proto.InternalMessageInfo -func (m *QueryRawCheckpointRequest) GetEpochNum() int64 { +func (m *QueryRawCheckpointRequest) GetEpochNum() uint64 { if m != nil { return m.EpochNum } return 0 } -func (m *QueryRawCheckpointRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - // QueryRawCheckpointResponse is the response type for the Query/RawCheckpoint // RPC method. type QueryRawCheckpointResponse struct { RawCheckpoint *RawCheckpoint `protobuf:"bytes,1,opt,name=raw_checkpoint,json=rawCheckpoint,proto3" json:"raw_checkpoint,omitempty"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryRawCheckpointResponse) Reset() { *m = QueryRawCheckpointResponse{} } @@ -245,18 +235,9 @@ func (m *QueryRawCheckpointResponse) GetRawCheckpoint() *RawCheckpoint { return nil } -func (m *QueryRawCheckpointResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - // QueryLatestCheckpointRequest is the request type for the Query/LatestCheckpoint // RPC method. type QueryLatestCheckpointRequest struct { - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryLatestCheckpointRequest) Reset() { *m = QueryLatestCheckpointRequest{} } @@ -292,19 +273,10 @@ func (m *QueryLatestCheckpointRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryLatestCheckpointRequest proto.InternalMessageInfo -func (m *QueryLatestCheckpointRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - // QueryLatestCheckpointResponse is the response type for the Query/LatestCheckpoint // RPC method. type QueryLatestCheckpointResponse struct { LatestCheckpoint *RawCheckpoint `protobuf:"bytes,1,opt,name=latest_checkpoint,json=latestCheckpoint,proto3" json:"latest_checkpoint,omitempty"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryLatestCheckpointResponse) Reset() { *m = QueryLatestCheckpointResponse{} } @@ -347,13 +319,6 @@ func (m *QueryLatestCheckpointResponse) GetLatestCheckpoint() *RawCheckpoint { return nil } -func (m *QueryLatestCheckpointResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - // QueryUncheckpointedCheckpointsRequest is the request type for the Query/UncheckpointedCheckpoints // RPC method. type QueryUncheckpointedCheckpointsRequest struct { @@ -404,6 +369,7 @@ func (m *QueryUncheckpointedCheckpointsRequest) GetPagination() *query.PageReque // QueryUncheckpointedCheckpointsResponse is the response type for the Query/UncheckpointedCheckpoints // RPC method. type QueryUncheckpointedCheckpointsResponse struct { + // the order is going from the newest to oldest based on the epoch number UncheckpointedCheckpoint []*RawCheckpoint `protobuf:"bytes,1,rep,name=uncheckpointed_checkpoint,json=uncheckpointedCheckpoint,proto3" json:"uncheckpointed_checkpoint,omitempty"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` @@ -508,6 +474,7 @@ func (m *QueryUnderconfirmedCheckpointsRequest) GetPagination() *query.PageReque // QueryUnderconfirmedCheckpointsResponse is the response type for the Query/UnderconfirmedCheckpoints // RPC method. type QueryUnderconfirmedCheckpointsResponse struct { + // the order is going from the newest to oldest based on the epoch number UnderconfirmedCheckpoint []*RawCheckpoint `protobuf:"bytes,1,rep,name=underconfirmed_checkpoint,json=underconfirmedCheckpoint,proto3" json:"underconfirmed_checkpoint,omitempty"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` @@ -612,6 +579,7 @@ func (m *QueryConfirmedCheckpointsRequest) GetPagination() *query.PageRequest { // QueryConfirmedCheckpointsResponse is the response type for the Query/ConfirmedCheckpoints // RPC method. type QueryConfirmedCheckpointsResponse struct { + // the order is going from the newest to oldest based on the epoch number ConfirmedCheckpoint []*RawCheckpoint `protobuf:"bytes,1,rep,name=confirmed_checkpoint,json=confirmedCheckpoint,proto3" json:"confirmed_checkpoint,omitempty"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` @@ -668,7 +636,7 @@ func (m *QueryConfirmedCheckpointsResponse) GetPagination() *query.PageResponse // RPC method. type QueryBlsSigsRequest struct { // epoch_num defines the epoch for the queried bls sigs - EpochNum int64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` + EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` // pagination defines an optional pagination for the request. Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -706,7 +674,7 @@ func (m *QueryBlsSigsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryBlsSigsRequest proto.InternalMessageInfo -func (m *QueryBlsSigsRequest) GetEpochNum() int64 { +func (m *QueryBlsSigsRequest) GetEpochNum() uint64 { if m != nil { return m.EpochNum } @@ -880,62 +848,62 @@ func init() { func init() { proto.RegisterFile("babylon/checkpointing/query.proto", fileDescriptor_a0fdb8f0f85bb51e) } var fileDescriptor_a0fdb8f0f85bb51e = []byte{ - // 876 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x97, 0xcf, 0x4f, 0x13, 0x4d, - 0x18, 0xc7, 0x3b, 0xf0, 0xbe, 0xc0, 0x3b, 0xbc, 0x54, 0x1c, 0x7a, 0x28, 0x0b, 0xd6, 0xd2, 0x28, - 0x34, 0x2a, 0xbb, 0x96, 0x9f, 0x09, 0x10, 0x35, 0x25, 0xea, 0xc5, 0x20, 0x56, 0xb9, 0x70, 0x69, - 0x76, 0xcb, 0xb2, 0x5d, 0x6d, 0x77, 0x96, 0x9d, 0x2d, 0x88, 0xc4, 0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18, 0x05, 0x71, 0x90, 0xec, 0xcc, 0xfc, 0x5f, 0x39, 0xbd, 0x5b, 0x39, 0x5c, 0x2a, 0x15, - 0xd1, 0x3d, 0x08, 0x6b, 0xc6, 0xa2, 0x1d, 0x71, 0x90, 0xec, 0x9d, 0x18, 0x95, 0x3d, 0x0a, 0x72, - 0x85, 0x82, 0xec, 0x81, 0x63, 0x14, 0xe4, 0x65, 0xd5, 0xd0, 0x59, 0x87, 0xcc, 0x91, 0xcc, 0xc4, - 0x2e, 0x80, 0x43, 0xbe, 0x62, 0x88, 0x8d, 0x2d, 0xa2, 0xa3, 0x65, 0x78, 0xc1, 0x51, 0xb7, 0xb2, - 0x35, 0x13, 0x24, 0x0a, 0xe2, 0x9d, 0xc9, 0xde, 0x89, 0x31, 0x59, 0xf4, 0x30, 0x64, 0xae, 0x54, - 0x26, 0xec, 0x70, 0x95, 0xd1, 0x7d, 0x1f, 0xe5, 0x63, 0x81, 0xca, 0x3d, 0x39, 0x9c, 0xf4, 0x57, - 0x00, 0x0e, 0x1e, 0x97, 0x5e, 0xc5, 0x38, 0x04, 0xff, 0xab, 0x27, 0xd8, 0xa3, 0xb7, 0x9b, 0xde, - 0x27, 0xdf, 0x47, 0x79, 0x08, 0x6f, 0x09, 0x86, 0x79, 0x78, 0x54, 0x48, 0x0b, 0xec, 0xfa, 0x38, - 0x76, 0xed, 0x43, 0xb7, 0x0e, 0x87, 0xa9, 0xec, 0x07, 0xaa, 0xab, 0x13, 0xf7, 0x38, 0x3c, 0x9e, - 0x0f, 0x38, 0x31, 0x9f, 0xcf, 0x00, 0x5e, 0x12, 0x34, 0x62, 0x88, 0x9e, 0xc0, 0x8b, 0x05, 0x7a, - 0xef, 0x14, 0x94, 0xfa, 0x0b, 0x75, 0xd5, 0xdb, 0x07, 0x0a, 0xc3, 0xab, 0x54, 0xff, 0x8a, 0x55, - 0xd3, 0xa0, 0xaf, 0xf9, 0xbc, 0xb5, 0xed, 0x22, 0xf6, 0x0d, 0xc0,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ff, 0xd2, 0x78, 0x93, 0xd1, 0x4c, 0x5f, 0x92, 0xea, - 0x4b, 0xa0, 0xb8, 0x58, 0x9f, 0x37, 0x01, 0xd2, 0x0f, 0xcb, 0xfb, 0x31, 0xb0, 0xb7, 0x1f, 0x03, - 0xbf, 0xf6, 0x63, 0xe0, 0xdd, 0x41, 0x2c, 0xb4, 0x77, 0x10, 0x0b, 0x7d, 0x3f, 0x88, 0x85, 0x56, - 0xa7, 0x0d, 0xd3, 0xcd, 0x97, 0x34, 0x39, 0x87, 0x8b, 0xd5, 0x2a, 0xb9, 0xbc, 0x6a, 0x5a, 0x87, - 0x25, 0x9f, 0xd7, 0x15, 0x75, 0xb7, 0x6d, 0x9d, 0x68, 0x5d, 0xf4, 0xa7, 0xf5, 0xe4, 0xdf, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x5e, 0x65, 0xa3, 0xeb, 0x45, 0x10, 0x00, 0x00, + // 872 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xcf, 0x53, 0xdb, 0x46, + 0x18, 0xf5, 0x52, 0x0a, 0x74, 0x29, 0x2e, 0x5d, 0x7c, 0x30, 0x82, 0xba, 0x46, 0xd3, 0x82, 0xa7, + 0x2d, 0x52, 0xcd, 0xcf, 0x0e, 0x30, 0x6d, 0xc7, 0x4c, 0xdb, 0x4b, 0x87, 0x52, 0xb7, 0x5c, 0xb8, + 0x78, 0x24, 0x23, 0x64, 0xb5, 0xb6, 0x56, 0x68, 0x25, 0x28, 0x65, 0x72, 0xc9, 0x31, 0x97, 0x64, + 0x26, 0xd7, 0x1c, 0xf2, 0x67, 0x70, 0xcd, 0xcd, 0x47, 0x66, 0x72, 0x48, 0x0e, 0x99, 0x4c, 0x06, + 0xf2, 0x7f, 0x24, 0xe3, 0xd5, 0x0a, 0xb3, 0x46, 0x6b, 0xc9, 0xe0, 0x70, 0x13, 0xbb, 0xdf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 0x72, 0xa9, 0xdd, 0x65, 0xd3, 0xf2, + 0x6a, 0xbe, 0xae, 0x54, 0x71, 0x23, 0x44, 0xa9, 0xd6, 0x34, 0xcb, 0xbe, 0x84, 0xfc, 0xaf, 0x03, + 0xd4, 0x3b, 0x76, 0x0c, 0xa2, 0x0f, 0xd1, 0x5f, 0x8d, 0x8b, 0xef, 0x03, 0x00, 0x00, 0xff, 0xff, + 0xcc, 0x8b, 0x6b, 0xad, 0x20, 0x0f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1395,18 +1363,6 @@ func (m *QueryRawCheckpointRequest) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } if m.EpochNum != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.EpochNum)) i-- @@ -1435,18 +1391,6 @@ func (m *QueryRawCheckpointResponse) MarshalToSizedBuffer(dAtA []byte) (int, err _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } if m.RawCheckpoint != nil { { size, err := m.RawCheckpoint.MarshalToSizedBuffer(dAtA[:i]) @@ -1482,18 +1426,6 @@ func (m *QueryLatestCheckpointRequest) MarshalToSizedBuffer(dAtA []byte) (int, e _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.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 } @@ -1517,18 +1449,6 @@ func (m *QueryLatestCheckpointResponse) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } if m.LatestCheckpoint != nil { { size, err := m.LatestCheckpoint.MarshalToSizedBuffer(dAtA[:i]) @@ -1996,10 +1916,6 @@ func (m *QueryRawCheckpointRequest) Size() (n int) { if m.EpochNum != 0 { n += 1 + sovQuery(uint64(m.EpochNum)) } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } return n } @@ -2013,10 +1929,6 @@ func (m *QueryRawCheckpointResponse) Size() (n int) { l = m.RawCheckpoint.Size() n += 1 + l + sovQuery(uint64(l)) } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } return n } @@ -2026,10 +1938,6 @@ func (m *QueryLatestCheckpointRequest) Size() (n int) { } var l int _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } return n } @@ -2043,10 +1951,6 @@ func (m *QueryLatestCheckpointResponse) Size() (n int) { l = m.LatestCheckpoint.Size() n += 1 + l + sovQuery(uint64(l)) } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } return n } @@ -2250,7 +2154,7 @@ func (m *QueryRawCheckpointsRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.FromEpochNum |= int64(b&0x7F) << shift + m.FromEpochNum |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -2475,47 +2379,11 @@ func (m *QueryRawCheckpointRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.EpochNum |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 + m.EpochNum |= uint64(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.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -2602,42 +2470,6 @@ func (m *QueryRawCheckpointResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -2688,42 +2520,6 @@ func (m *QueryLatestCheckpointRequest) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: QueryLatestCheckpointRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -2810,42 +2606,6 @@ func (m *QueryLatestCheckpointResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3528,7 +3288,7 @@ func (m *QueryBlsSigsRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.EpochNum |= int64(b&0x7F) << shift + m.EpochNum |= uint64(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/checkpointing/types/query.pb.gw.go b/x/checkpointing/types/query.pb.gw.go index 5a1199f96..d35225ced 100644 --- a/x/checkpointing/types/query.pb.gw.go +++ b/x/checkpointing/types/query.pb.gw.go @@ -51,7 +51,7 @@ func request_Query_RawCheckpoints_0(ctx context.Context, marshaler runtime.Marsh return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "from_epoch_num") } - protoReq.FromEpochNum, err = runtime.Int64(val) + protoReq.FromEpochNum, err = runtime.Uint64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "from_epoch_num", err) @@ -85,7 +85,7 @@ func local_request_Query_RawCheckpoints_0(ctx context.Context, marshaler runtime return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "from_epoch_num") } - protoReq.FromEpochNum, err = runtime.Int64(val) + protoReq.FromEpochNum, err = runtime.Uint64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "from_epoch_num", err) @@ -103,10 +103,6 @@ func local_request_Query_RawCheckpoints_0(ctx context.Context, marshaler runtime } -var ( - filter_Query_RawCheckpoint_0 = &utilities.DoubleArray{Encoding: map[string]int{"epoch_num": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) - func request_Query_RawCheckpoint_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryRawCheckpointRequest var metadata runtime.ServerMetadata @@ -123,19 +119,12 @@ func request_Query_RawCheckpoint_0(ctx context.Context, marshaler runtime.Marsha return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_num") } - protoReq.EpochNum, err = runtime.Int64(val) + protoReq.EpochNum, err = runtime.Uint64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_num", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RawCheckpoint_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := client.RawCheckpoint(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -157,39 +146,21 @@ func local_request_Query_RawCheckpoint_0(ctx context.Context, marshaler runtime. return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_num") } - protoReq.EpochNum, err = runtime.Int64(val) + protoReq.EpochNum, err = runtime.Uint64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_num", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RawCheckpoint_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.RawCheckpoint(ctx, &protoReq) return msg, metadata, err } -var ( - filter_Query_LatestCheckpoint_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - func request_Query_LatestCheckpoint_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryLatestCheckpointRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LatestCheckpoint_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := client.LatestCheckpoint(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -199,13 +170,6 @@ func local_request_Query_LatestCheckpoint_0(ctx context.Context, marshaler runti var protoReq QueryLatestCheckpointRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LatestCheckpoint_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.LatestCheckpoint(ctx, &protoReq) return msg, metadata, err @@ -339,7 +303,7 @@ func request_Query_BlsSigs_0(ctx context.Context, marshaler runtime.Marshaler, c return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_num") } - protoReq.EpochNum, err = runtime.Int64(val) + protoReq.EpochNum, err = runtime.Uint64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_num", err) @@ -373,7 +337,7 @@ func local_request_Query_BlsSigs_0(ctx context.Context, marshaler runtime.Marsha return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_num") } - protoReq.EpochNum, err = runtime.Int64(val) + protoReq.EpochNum, err = runtime.Uint64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_num", err) From a65243ea07000d88c5f529af932ede9b032e5d23 Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Tue, 14 Jun 2022 10:24:08 +0800 Subject: [PATCH 04/16] changed proto according to comments --- proto/babylon/checkpointing/query.proto | 117 +- x/checkpointing/keeper/grpc_query_bls.go | 10 + x/checkpointing/keeper/grpc_query_blssigs.go | 10 - .../keeper/grpc_query_checkpoint.go | 14 +- x/checkpointing/types/query.pb.go | 2121 +++++------------ x/checkpointing/types/query.pb.gw.go | 354 +-- 6 files changed, 779 insertions(+), 1847 deletions(-) create mode 100644 x/checkpointing/keeper/grpc_query_bls.go delete mode 100644 x/checkpointing/keeper/grpc_query_blssigs.go diff --git a/proto/babylon/checkpointing/query.proto b/proto/babylon/checkpointing/query.proto index c71290ce6..797466829 100644 --- a/proto/babylon/checkpointing/query.proto +++ b/proto/babylon/checkpointing/query.proto @@ -11,9 +11,13 @@ option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; // Query defines the gRPC querier service. service Query { - // RawCheckpoints queries a list of checkpoints starting from a given epoch number to the current epoch number. + // RawCheckpoints queries all checkpoints that match the given status. rpc RawCheckpoints(QueryRawCheckpointsRequest) returns (QueryRawCheckpointsResponse) { - option (google.api.http).get = "/babylon/checkpointing/v1/raw_checkpoints/{from_epoch_num}"; + option (google.api.http).get = "/babylon/checkpointing/v1/raw_checkpoints/{status}"; + } + // RawCheckpoints queries a list of checkpoints starting from a given epoch number to the current epoch number. + rpc RecentRawCheckpoints(QueryRecentRawCheckpointsRequest) returns (QueryRecentRawCheckpointsResponse) { + option (google.api.http).get = "/babylon/checkpointing/v1/recent_raw_checkpoints/{from_epoch_num}"; } // RawCheckpoint queries a checkpoints at a given epoch number. @@ -26,24 +30,9 @@ service Query { option (google.api.http).get = "/babylon/checkpointing/v1/latest_checkpoint"; } - // UncheckpointedCheckpoints queries a list of checkpoints with the status of UNCHECKPOINTED. - rpc UncheckpointedCheckpoints(QueryUncheckpointedCheckpointsRequest) returns (QueryUncheckpointedCheckpointsResponse) { - option (google.api.http).get = "/babylon/checkpointing/v1/uncheckpointed_checkpoints"; - } - - // UnderconfirmedCheckpoints queries a list of checkpoints with the status of CHECKPOINTED_NOT_CONFIRMED. - rpc UnderconfirmedCheckpoints(QueryUnderconfirmedCheckpointsRequest) returns (QueryUnderconfirmedCheckpointsResponse) { - option (google.api.http).get = "/babylon/checkpointing/v1/underconfirmed_checkpoints"; - } - - // ConfirmedCheckpoints queries a list of checkpoints with the status of CONFIRMED. - rpc ConfirmedCheckpoints(QueryConfirmedCheckpointsRequest) returns (QueryConfirmedCheckpointsResponse) { - option (google.api.http).get = "/babylon/checkpointing/v1/confirmed_checkpoints"; - } - - // BlsSigs queries a list of bls sigs of the validators at a given epoch number. - rpc BlsSigs(QueryBlsSigsRequest) returns (QueryBlsSigsResponse) { - option (google.api.http).get = "/babylon/checkpointing/v1/bls_sigs/{epoch_num}"; + // BlsPublicKeys queries a list of bls public keys of the validators at a given epoch number. + rpc BlsPublicKeys(QueryBlsPublicKeysRequest) returns (QueryBlsPublicKeysResponse) { + option (google.api.http).get = "/babylon/checkpointing/v1/bls_public_keys/{epoch_num}"; } // Parameters queries the parameters of the module. @@ -55,8 +44,8 @@ service Query { // QueryRawCheckpointsRequest is the request type for the Query/RawCheckpoints // RPC method. message QueryRawCheckpointsRequest { - // from_epoch defines the start epoch of the query, which is inclusive - uint64 from_epoch_num = 1; + // status defines the status of the raw checkpoints of the query + string status = 1; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; @@ -72,93 +61,63 @@ message QueryRawCheckpointsResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } -// QueryRawCheckpointRequest is the request type for the Query/RawCheckpoint +// QueryRecentRawCheckpointsRequest is the request type for the Query/RecentRawCheckpoints // RPC method. -message QueryRawCheckpointRequest { - // epoch_num defines the epoch for the queried checkpoint - uint64 epoch_num = 1; -} - -// QueryRawCheckpointResponse is the response type for the Query/RawCheckpoint -// RPC method. -message QueryRawCheckpointResponse { - RawCheckpoint raw_checkpoint = 1; -} - -// QueryLatestCheckpointRequest is the request type for the Query/LatestCheckpoint -// RPC method. -message QueryLatestCheckpointRequest {} - -// QueryLatestCheckpointResponse is the response type for the Query/LatestCheckpoint -// RPC method. -message QueryLatestCheckpointResponse { - RawCheckpoint latest_checkpoint = 1; -} +message QueryRecentRawCheckpointsRequest { + // from_epoch defines the start epoch of the query, which is inclusive + uint64 from_epoch_num = 1; -// QueryUncheckpointedCheckpointsRequest is the request type for the Query/UncheckpointedCheckpoints -// RPC method. -message QueryUncheckpointedCheckpointsRequest { // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 1; + cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// QueryUncheckpointedCheckpointsResponse is the response type for the Query/UncheckpointedCheckpoints +// QueryRecentRawCheckpointsResponse is the response type for the Query/RecentRawCheckpoints // RPC method. -message QueryUncheckpointedCheckpointsResponse { +message QueryRecentRawCheckpointsResponse { // the order is going from the newest to oldest based on the epoch number - repeated RawCheckpoint uncheckpointed_checkpoint = 1; + repeated RawCheckpoint raw_checkpoints = 1; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; } -// QueryUnderconfirmedCheckpointsRequest is the request type for the Query/UnderconfirmedCheckpoints +// QueryRawCheckpointRequest is the request type for the Query/RawCheckpoint // RPC method. -message QueryUnderconfirmedCheckpointsRequest { - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 1; +message QueryRawCheckpointRequest { + // epoch_num defines the epoch for the queried checkpoint + uint64 epoch_num = 1; } -// QueryUnderconfirmedCheckpointsResponse is the response type for the Query/UnderconfirmedCheckpoints +// QueryRawCheckpointResponse is the response type for the Query/RawCheckpoint // RPC method. -message QueryUnderconfirmedCheckpointsResponse { - // the order is going from the newest to oldest based on the epoch number - repeated RawCheckpoint underconfirmed_checkpoint = 1; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; +message QueryRawCheckpointResponse { + RawCheckpoint raw_checkpoint = 1; } -// QueryConfirmedCheckpointsRequest is the request type for the Query/ConfirmedCheckpoints +// QueryLatestCheckpointRequest is the request type for the Query/LatestCheckpoint // RPC method. -message QueryConfirmedCheckpointsRequest { - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} +message QueryLatestCheckpointRequest {} -// QueryConfirmedCheckpointsResponse is the response type for the Query/ConfirmedCheckpoints +// QueryLatestCheckpointResponse is the response type for the Query/LatestCheckpoint // RPC method. -message QueryConfirmedCheckpointsResponse { - // the order is going from the newest to oldest based on the epoch number - repeated RawCheckpoint confirmed_checkpoint = 1; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; +message QueryLatestCheckpointResponse { + RawCheckpoint latest_checkpoint = 1; } -// QueryBlsSigsRequest is the request type for the Query/BlsSigs +// QueryBlsPublicKeysRequest is the request type for the Query/BlsPublicKeys // RPC method. -message QueryBlsSigsRequest { - // epoch_num defines the epoch for the queried bls sigs +message QueryBlsPublicKeysRequest { + // epoch_num defines the epoch for the queried bls public keys uint64 epoch_num = 1; + // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// QueryBlsSigsResponse is the response type for the Query/BlsSigs +// QueryBlsPublicKeysResponse is the response type for the Query/BlsPublicKeys // RPC method. -message QueryBlsSigsResponse { - repeated BlsSig bls_sigs = 1; +message QueryBlsPublicKeysResponse { + repeated bytes bls_pub_keys = 1; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; diff --git a/x/checkpointing/keeper/grpc_query_bls.go b/x/checkpointing/keeper/grpc_query_bls.go new file mode 100644 index 000000000..12a7aa47b --- /dev/null +++ b/x/checkpointing/keeper/grpc_query_bls.go @@ -0,0 +1,10 @@ +package keeper + +import ( + "context" + "github.com/babylonchain/babylon/x/checkpointing/types" +) + +func (k Keeper) BlsPublicKeys(c context.Context, req *types.QueryBlsPublicKeysRequest) (*types.QueryBlsPublicKeysResponse, error) { + panic("TODO: implement this") +} diff --git a/x/checkpointing/keeper/grpc_query_blssigs.go b/x/checkpointing/keeper/grpc_query_blssigs.go deleted file mode 100644 index bcd7e46e5..000000000 --- a/x/checkpointing/keeper/grpc_query_blssigs.go +++ /dev/null @@ -1,10 +0,0 @@ -package keeper - -import ( - "context" - "github.com/babylonchain/babylon/x/checkpointing/types" -) - -func (k Keeper) BlsSigs(c context.Context, req *types.QueryBlsSigsRequest) (*types.QueryBlsSigsResponse, error) { - panic("TODO: implement this") -} diff --git a/x/checkpointing/keeper/grpc_query_checkpoint.go b/x/checkpointing/keeper/grpc_query_checkpoint.go index a215c0078..018855257 100644 --- a/x/checkpointing/keeper/grpc_query_checkpoint.go +++ b/x/checkpointing/keeper/grpc_query_checkpoint.go @@ -11,22 +11,14 @@ func (k Keeper) RawCheckpoints(c context.Context, req *types.QueryRawCheckpoints panic("TODO: implement this") } -func (k Keeper) RawCheckpoint(c context.Context, req *types.QueryRawCheckpointRequest) (*types.QueryRawCheckpointResponse, error) { - panic("TODO: implement this") -} - -func (k Keeper) LatestCheckpoint(c context.Context, req *types.QueryLatestCheckpointRequest) (*types.QueryLatestCheckpointResponse, error) { +func (k Keeper) RecentRawCheckpoints(c context.Context, req *types.QueryRecentRawCheckpointsRequest) (*types.QueryRecentRawCheckpointsResponse, error) { panic("TODO: implement this") } -func (k Keeper) UncheckpointedCheckpoints(c context.Context, req *types.QueryUncheckpointedCheckpointsRequest) (*types.QueryUncheckpointedCheckpointsResponse, error) { - panic("TODO: implement this") -} - -func (k Keeper) UnderconfirmedCheckpoints(c context.Context, req *types.QueryUnderconfirmedCheckpointsRequest) (*types.QueryUnderconfirmedCheckpointsResponse, error) { +func (k Keeper) RawCheckpoint(c context.Context, req *types.QueryRawCheckpointRequest) (*types.QueryRawCheckpointResponse, error) { panic("TODO: implement this") } -func (k Keeper) ConfirmedCheckpoints(c context.Context, req *types.QueryConfirmedCheckpointsRequest) (*types.QueryConfirmedCheckpointsResponse, error) { +func (k Keeper) LatestCheckpoint(c context.Context, req *types.QueryLatestCheckpointRequest) (*types.QueryLatestCheckpointResponse, error) { panic("TODO: implement this") } diff --git a/x/checkpointing/types/query.pb.go b/x/checkpointing/types/query.pb.go index cb4fa1177..96c70c916 100644 --- a/x/checkpointing/types/query.pb.go +++ b/x/checkpointing/types/query.pb.go @@ -33,8 +33,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // QueryRawCheckpointsRequest is the request type for the Query/RawCheckpoints // RPC method. type QueryRawCheckpointsRequest struct { - // from_epoch defines the start epoch of the query, which is inclusive - FromEpochNum uint64 `protobuf:"varint,1,opt,name=from_epoch_num,json=fromEpochNum,proto3" json:"from_epoch_num,omitempty"` + // status defines the status of the raw checkpoints of the query + Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` // pagination defines an optional pagination for the request. Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -72,11 +72,11 @@ func (m *QueryRawCheckpointsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryRawCheckpointsRequest proto.InternalMessageInfo -func (m *QueryRawCheckpointsRequest) GetFromEpochNum() uint64 { +func (m *QueryRawCheckpointsRequest) GetStatus() string { if m != nil { - return m.FromEpochNum + return m.Status } - return 0 + return "" } func (m *QueryRawCheckpointsRequest) GetPagination() *query.PageRequest { @@ -142,6 +142,118 @@ func (m *QueryRawCheckpointsResponse) GetPagination() *query.PageResponse { return nil } +// QueryRecentRawCheckpointsRequest is the request type for the Query/RecentRawCheckpoints +// RPC method. +type QueryRecentRawCheckpointsRequest struct { + // from_epoch defines the start epoch of the query, which is inclusive + FromEpochNum uint64 `protobuf:"varint,1,opt,name=from_epoch_num,json=fromEpochNum,proto3" json:"from_epoch_num,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryRecentRawCheckpointsRequest) Reset() { *m = QueryRecentRawCheckpointsRequest{} } +func (m *QueryRecentRawCheckpointsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRecentRawCheckpointsRequest) ProtoMessage() {} +func (*QueryRecentRawCheckpointsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a0fdb8f0f85bb51e, []int{2} +} +func (m *QueryRecentRawCheckpointsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRecentRawCheckpointsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRecentRawCheckpointsRequest.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 *QueryRecentRawCheckpointsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRecentRawCheckpointsRequest.Merge(m, src) +} +func (m *QueryRecentRawCheckpointsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryRecentRawCheckpointsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRecentRawCheckpointsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRecentRawCheckpointsRequest proto.InternalMessageInfo + +func (m *QueryRecentRawCheckpointsRequest) GetFromEpochNum() uint64 { + if m != nil { + return m.FromEpochNum + } + return 0 +} + +func (m *QueryRecentRawCheckpointsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryRecentRawCheckpointsResponse is the response type for the Query/RecentRawCheckpoints +// RPC method. +type QueryRecentRawCheckpointsResponse struct { + // the order is going from the newest to oldest based on the epoch number + RawCheckpoints []*RawCheckpoint `protobuf:"bytes,1,rep,name=raw_checkpoints,json=rawCheckpoints,proto3" json:"raw_checkpoints,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryRecentRawCheckpointsResponse) Reset() { *m = QueryRecentRawCheckpointsResponse{} } +func (m *QueryRecentRawCheckpointsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRecentRawCheckpointsResponse) ProtoMessage() {} +func (*QueryRecentRawCheckpointsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a0fdb8f0f85bb51e, []int{3} +} +func (m *QueryRecentRawCheckpointsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRecentRawCheckpointsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRecentRawCheckpointsResponse.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 *QueryRecentRawCheckpointsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRecentRawCheckpointsResponse.Merge(m, src) +} +func (m *QueryRecentRawCheckpointsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryRecentRawCheckpointsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRecentRawCheckpointsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRecentRawCheckpointsResponse proto.InternalMessageInfo + +func (m *QueryRecentRawCheckpointsResponse) GetRawCheckpoints() []*RawCheckpoint { + if m != nil { + return m.RawCheckpoints + } + return nil +} + +func (m *QueryRecentRawCheckpointsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + // QueryRawCheckpointRequest is the request type for the Query/RawCheckpoint // RPC method. type QueryRawCheckpointRequest struct { @@ -153,7 +265,7 @@ func (m *QueryRawCheckpointRequest) Reset() { *m = QueryRawCheckpointReq func (m *QueryRawCheckpointRequest) String() string { return proto.CompactTextString(m) } func (*QueryRawCheckpointRequest) ProtoMessage() {} func (*QueryRawCheckpointRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{2} + return fileDescriptor_a0fdb8f0f85bb51e, []int{4} } func (m *QueryRawCheckpointRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -199,7 +311,7 @@ func (m *QueryRawCheckpointResponse) Reset() { *m = QueryRawCheckpointRe func (m *QueryRawCheckpointResponse) String() string { return proto.CompactTextString(m) } func (*QueryRawCheckpointResponse) ProtoMessage() {} func (*QueryRawCheckpointResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{3} + return fileDescriptor_a0fdb8f0f85bb51e, []int{5} } func (m *QueryRawCheckpointResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -244,7 +356,7 @@ func (m *QueryLatestCheckpointRequest) Reset() { *m = QueryLatestCheckpo func (m *QueryLatestCheckpointRequest) String() string { return proto.CompactTextString(m) } func (*QueryLatestCheckpointRequest) ProtoMessage() {} func (*QueryLatestCheckpointRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{4} + return fileDescriptor_a0fdb8f0f85bb51e, []int{6} } func (m *QueryLatestCheckpointRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -283,7 +395,7 @@ func (m *QueryLatestCheckpointResponse) Reset() { *m = QueryLatestCheckp func (m *QueryLatestCheckpointResponse) String() string { return proto.CompactTextString(m) } func (*QueryLatestCheckpointResponse) ProtoMessage() {} func (*QueryLatestCheckpointResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{5} + return fileDescriptor_a0fdb8f0f85bb51e, []int{7} } func (m *QueryLatestCheckpointResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -319,25 +431,27 @@ func (m *QueryLatestCheckpointResponse) GetLatestCheckpoint() *RawCheckpoint { return nil } -// QueryUncheckpointedCheckpointsRequest is the request type for the Query/UncheckpointedCheckpoints +// QueryBlsPublicKeysRequest is the request type for the Query/BlsPublicKeys // RPC method. -type QueryUncheckpointedCheckpointsRequest struct { +type QueryBlsPublicKeysRequest struct { + // epoch_num defines the epoch for the queried bls public keys + EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryUncheckpointedCheckpointsRequest) Reset() { *m = QueryUncheckpointedCheckpointsRequest{} } -func (m *QueryUncheckpointedCheckpointsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryUncheckpointedCheckpointsRequest) ProtoMessage() {} -func (*QueryUncheckpointedCheckpointsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{6} +func (m *QueryBlsPublicKeysRequest) Reset() { *m = QueryBlsPublicKeysRequest{} } +func (m *QueryBlsPublicKeysRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBlsPublicKeysRequest) ProtoMessage() {} +func (*QueryBlsPublicKeysRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a0fdb8f0f85bb51e, []int{8} } -func (m *QueryUncheckpointedCheckpointsRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryBlsPublicKeysRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryUncheckpointedCheckpointsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryBlsPublicKeysRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryUncheckpointedCheckpointsRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryBlsPublicKeysRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -347,48 +461,52 @@ func (m *QueryUncheckpointedCheckpointsRequest) XXX_Marshal(b []byte, determinis return b[:n], nil } } -func (m *QueryUncheckpointedCheckpointsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryUncheckpointedCheckpointsRequest.Merge(m, src) +func (m *QueryBlsPublicKeysRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlsPublicKeysRequest.Merge(m, src) } -func (m *QueryUncheckpointedCheckpointsRequest) XXX_Size() int { +func (m *QueryBlsPublicKeysRequest) XXX_Size() int { return m.Size() } -func (m *QueryUncheckpointedCheckpointsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryUncheckpointedCheckpointsRequest.DiscardUnknown(m) +func (m *QueryBlsPublicKeysRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlsPublicKeysRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryUncheckpointedCheckpointsRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryBlsPublicKeysRequest proto.InternalMessageInfo + +func (m *QueryBlsPublicKeysRequest) GetEpochNum() uint64 { + if m != nil { + return m.EpochNum + } + return 0 +} -func (m *QueryUncheckpointedCheckpointsRequest) GetPagination() *query.PageRequest { +func (m *QueryBlsPublicKeysRequest) GetPagination() *query.PageRequest { if m != nil { return m.Pagination } return nil } -// QueryUncheckpointedCheckpointsResponse is the response type for the Query/UncheckpointedCheckpoints +// QueryBlsPublicKeysResponse is the response type for the Query/BlsPublicKeys // RPC method. -type QueryUncheckpointedCheckpointsResponse struct { - // the order is going from the newest to oldest based on the epoch number - UncheckpointedCheckpoint []*RawCheckpoint `protobuf:"bytes,1,rep,name=uncheckpointed_checkpoint,json=uncheckpointedCheckpoint,proto3" json:"uncheckpointed_checkpoint,omitempty"` +type QueryBlsPublicKeysResponse struct { + BlsPubKeys [][]byte `protobuf:"bytes,1,rep,name=bls_pub_keys,json=blsPubKeys,proto3" json:"bls_pub_keys,omitempty"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryUncheckpointedCheckpointsResponse) Reset() { - *m = QueryUncheckpointedCheckpointsResponse{} -} -func (m *QueryUncheckpointedCheckpointsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryUncheckpointedCheckpointsResponse) ProtoMessage() {} -func (*QueryUncheckpointedCheckpointsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{7} +func (m *QueryBlsPublicKeysResponse) Reset() { *m = QueryBlsPublicKeysResponse{} } +func (m *QueryBlsPublicKeysResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBlsPublicKeysResponse) ProtoMessage() {} +func (*QueryBlsPublicKeysResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a0fdb8f0f85bb51e, []int{9} } -func (m *QueryUncheckpointedCheckpointsResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryBlsPublicKeysResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryUncheckpointedCheckpointsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryBlsPublicKeysResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryUncheckpointedCheckpointsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryBlsPublicKeysResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -398,51 +516,48 @@ func (m *QueryUncheckpointedCheckpointsResponse) XXX_Marshal(b []byte, determini return b[:n], nil } } -func (m *QueryUncheckpointedCheckpointsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryUncheckpointedCheckpointsResponse.Merge(m, src) +func (m *QueryBlsPublicKeysResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlsPublicKeysResponse.Merge(m, src) } -func (m *QueryUncheckpointedCheckpointsResponse) XXX_Size() int { +func (m *QueryBlsPublicKeysResponse) XXX_Size() int { return m.Size() } -func (m *QueryUncheckpointedCheckpointsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryUncheckpointedCheckpointsResponse.DiscardUnknown(m) +func (m *QueryBlsPublicKeysResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlsPublicKeysResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryUncheckpointedCheckpointsResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryBlsPublicKeysResponse proto.InternalMessageInfo -func (m *QueryUncheckpointedCheckpointsResponse) GetUncheckpointedCheckpoint() []*RawCheckpoint { +func (m *QueryBlsPublicKeysResponse) GetBlsPubKeys() [][]byte { if m != nil { - return m.UncheckpointedCheckpoint + return m.BlsPubKeys } return nil } -func (m *QueryUncheckpointedCheckpointsResponse) GetPagination() *query.PageResponse { +func (m *QueryBlsPublicKeysResponse) GetPagination() *query.PageResponse { if m != nil { return m.Pagination } return nil } -// QueryUnderconfirmedCheckpointsRequest is the request type for the Query/UnderconfirmedCheckpoints -// RPC method. -type QueryUnderconfirmedCheckpointsRequest struct { - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { } -func (m *QueryUnderconfirmedCheckpointsRequest) Reset() { *m = QueryUnderconfirmedCheckpointsRequest{} } -func (m *QueryUnderconfirmedCheckpointsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryUnderconfirmedCheckpointsRequest) ProtoMessage() {} -func (*QueryUnderconfirmedCheckpointsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{8} +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_a0fdb8f0f85bb51e, []int{10} } -func (m *QueryUnderconfirmedCheckpointsRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryUnderconfirmedCheckpointsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryUnderconfirmedCheckpointsRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -452,48 +567,36 @@ func (m *QueryUnderconfirmedCheckpointsRequest) XXX_Marshal(b []byte, determinis return b[:n], nil } } -func (m *QueryUnderconfirmedCheckpointsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryUnderconfirmedCheckpointsRequest.Merge(m, src) +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) } -func (m *QueryUnderconfirmedCheckpointsRequest) XXX_Size() int { +func (m *QueryParamsRequest) XXX_Size() int { return m.Size() } -func (m *QueryUnderconfirmedCheckpointsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryUnderconfirmedCheckpointsRequest.DiscardUnknown(m) +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryUnderconfirmedCheckpointsRequest proto.InternalMessageInfo - -func (m *QueryUnderconfirmedCheckpointsRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo -// QueryUnderconfirmedCheckpointsResponse is the response type for the Query/UnderconfirmedCheckpoints -// RPC method. -type QueryUnderconfirmedCheckpointsResponse struct { - // the order is going from the newest to oldest based on the epoch number - UnderconfirmedCheckpoint []*RawCheckpoint `protobuf:"bytes,1,rep,name=underconfirmed_checkpoint,json=underconfirmedCheckpoint,proto3" json:"underconfirmed_checkpoint,omitempty"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } -func (m *QueryUnderconfirmedCheckpointsResponse) Reset() { - *m = QueryUnderconfirmedCheckpointsResponse{} -} -func (m *QueryUnderconfirmedCheckpointsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryUnderconfirmedCheckpointsResponse) ProtoMessage() {} -func (*QueryUnderconfirmedCheckpointsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{9} +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_a0fdb8f0f85bb51e, []int{11} } -func (m *QueryUnderconfirmedCheckpointsResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryUnderconfirmedCheckpointsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryUnderconfirmedCheckpointsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -503,454 +606,145 @@ func (m *QueryUnderconfirmedCheckpointsResponse) XXX_Marshal(b []byte, determini return b[:n], nil } } -func (m *QueryUnderconfirmedCheckpointsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryUnderconfirmedCheckpointsResponse.Merge(m, src) +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) } -func (m *QueryUnderconfirmedCheckpointsResponse) XXX_Size() int { +func (m *QueryParamsResponse) XXX_Size() int { return m.Size() } -func (m *QueryUnderconfirmedCheckpointsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryUnderconfirmedCheckpointsResponse.DiscardUnknown(m) +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryUnderconfirmedCheckpointsResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo -func (m *QueryUnderconfirmedCheckpointsResponse) GetUnderconfirmedCheckpoint() []*RawCheckpoint { +func (m *QueryParamsResponse) GetParams() Params { if m != nil { - return m.UnderconfirmedCheckpoint + return m.Params } - return nil + return Params{} } -func (m *QueryUnderconfirmedCheckpointsResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil +func init() { + proto.RegisterType((*QueryRawCheckpointsRequest)(nil), "babylon.checkpointing.v1.QueryRawCheckpointsRequest") + proto.RegisterType((*QueryRawCheckpointsResponse)(nil), "babylon.checkpointing.v1.QueryRawCheckpointsResponse") + proto.RegisterType((*QueryRecentRawCheckpointsRequest)(nil), "babylon.checkpointing.v1.QueryRecentRawCheckpointsRequest") + proto.RegisterType((*QueryRecentRawCheckpointsResponse)(nil), "babylon.checkpointing.v1.QueryRecentRawCheckpointsResponse") + proto.RegisterType((*QueryRawCheckpointRequest)(nil), "babylon.checkpointing.v1.QueryRawCheckpointRequest") + proto.RegisterType((*QueryRawCheckpointResponse)(nil), "babylon.checkpointing.v1.QueryRawCheckpointResponse") + proto.RegisterType((*QueryLatestCheckpointRequest)(nil), "babylon.checkpointing.v1.QueryLatestCheckpointRequest") + proto.RegisterType((*QueryLatestCheckpointResponse)(nil), "babylon.checkpointing.v1.QueryLatestCheckpointResponse") + proto.RegisterType((*QueryBlsPublicKeysRequest)(nil), "babylon.checkpointing.v1.QueryBlsPublicKeysRequest") + proto.RegisterType((*QueryBlsPublicKeysResponse)(nil), "babylon.checkpointing.v1.QueryBlsPublicKeysResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "babylon.checkpointing.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "babylon.checkpointing.v1.QueryParamsResponse") } -// QueryConfirmedCheckpointsRequest is the request type for the Query/ConfirmedCheckpoints -// RPC method. -type QueryConfirmedCheckpointsRequest struct { - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` -} +func init() { proto.RegisterFile("babylon/checkpointing/query.proto", fileDescriptor_a0fdb8f0f85bb51e) } -func (m *QueryConfirmedCheckpointsRequest) Reset() { *m = QueryConfirmedCheckpointsRequest{} } -func (m *QueryConfirmedCheckpointsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryConfirmedCheckpointsRequest) ProtoMessage() {} -func (*QueryConfirmedCheckpointsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{10} -} -func (m *QueryConfirmedCheckpointsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryConfirmedCheckpointsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryConfirmedCheckpointsRequest.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 *QueryConfirmedCheckpointsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryConfirmedCheckpointsRequest.Merge(m, src) -} -func (m *QueryConfirmedCheckpointsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryConfirmedCheckpointsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryConfirmedCheckpointsRequest.DiscardUnknown(m) +var fileDescriptor_a0fdb8f0f85bb51e = []byte{ + // 776 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4f, 0x4f, 0x13, 0x4d, + 0x1c, 0xee, 0xf0, 0xf2, 0x36, 0x30, 0x40, 0x5f, 0xde, 0x91, 0x18, 0x2c, 0x58, 0xcb, 0xc6, 0x40, + 0xa3, 0xb2, 0x9b, 0x96, 0x02, 0x06, 0xff, 0x24, 0x42, 0xd4, 0x18, 0x0d, 0xd6, 0x8d, 0x5e, 0xbc, + 0x34, 0xb3, 0x9b, 0x71, 0xbb, 0x61, 0xbb, 0xb3, 0x74, 0x76, 0xc1, 0x06, 0x49, 0x8c, 0x17, 0x8f, + 0x92, 0xf8, 0x65, 0xf0, 0xe2, 0x99, 0x23, 0x89, 0x17, 0xe3, 0xc1, 0x18, 0xe0, 0x83, 0x98, 0x9d, + 0x9d, 0x82, 0xd3, 0xee, 0x52, 0xaa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, 0xca, 0x2e, 0xf6, 0x8c, 0x13, 0x1a, 0xe6, 0xb8, + 0x86, 0x59, 0x74, 0x3d, 0x59, 0x43, 0x47, 0xa6, 0x85, 0xcf, 0x61, 0x44, 0x8a, 0x82, 0xae, 0xae, + 0xc7, 0x65, 0x57, 0x57, 0xd7, 0x63, 0xd3, 0x46, 0xb9, 0xc3, 0x19, 0x2f, 0xa2, 0xf9, 0x64, 0xc6, + 0x22, 0x8d, 0x1c, 0xdb, 0xe4, 0x81, 0x24, 0xd9, 0xfe, 0x01, 0xc0, 0x74, 0xf4, 0xda, 0xd1, 0x8d, + 0x2e, 0xfb, 0x4b, 0x21, 0x93, 0x9d, 0x3d, 0x63, 0xb5, 0xa0, 0x59, 0xe0, 0x34, 0x15, 0x94, 0x4f, + 0xa6, 0x19, 0xc5, 0xcc, 0xf2, 0xd3, 0xbd, 0x83, 0x1c, 0xd8, 0x3f, 0xc8, 0x81, 0x1f, 0x07, 0x39, + 0xb0, 0x73, 0x98, 0x4b, 0xed, 0x1f, 0xe6, 0x52, 0x5f, 0x0f, 0x73, 0xa9, 0x97, 0xf3, 0x96, 0xed, + 0xd7, 0x02, 0x43, 0x35, 0x69, 0xbd, 0xd5, 0xc5, 0xac, 0x61, 0xdb, 0x3d, 0x6e, 0xf9, 0xba, 0xad, + 0xa9, 0xdf, 0xf4, 0x08, 0x33, 0xd2, 0xfc, 0x4f, 0xe0, 0xdc, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xfd, 0x0f, 0x93, 0xf8, 0xef, 0x0a, 0x00, 0x00, } -var xxx_messageInfo_QueryConfirmedCheckpointsRequest proto.InternalMessageInfo +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn -func (m *QueryConfirmedCheckpointsRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} +// 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 -// QueryConfirmedCheckpointsResponse is the response type for the Query/ConfirmedCheckpoints -// RPC method. -type QueryConfirmedCheckpointsResponse struct { - // the order is going from the newest to oldest based on the epoch number - ConfirmedCheckpoint []*RawCheckpoint `protobuf:"bytes,1,rep,name=confirmed_checkpoint,json=confirmedCheckpoint,proto3" json:"confirmed_checkpoint,omitempty"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +// 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 { + // RawCheckpoints queries all checkpoints that match the given status. + RawCheckpoints(ctx context.Context, in *QueryRawCheckpointsRequest, opts ...grpc.CallOption) (*QueryRawCheckpointsResponse, error) + // RawCheckpoints queries a list of checkpoints starting from a given epoch number to the current epoch number. + RecentRawCheckpoints(ctx context.Context, in *QueryRecentRawCheckpointsRequest, opts ...grpc.CallOption) (*QueryRecentRawCheckpointsResponse, error) + // RawCheckpoint queries a checkpoints at a given epoch number. + RawCheckpoint(ctx context.Context, in *QueryRawCheckpointRequest, opts ...grpc.CallOption) (*QueryRawCheckpointResponse, error) + // LatestCheckpoint queries the latest checkpoint. + LatestCheckpoint(ctx context.Context, in *QueryLatestCheckpointRequest, opts ...grpc.CallOption) (*QueryLatestCheckpointResponse, error) + // BlsPublicKeys queries a list of bls public keys of the validators at a given epoch number. + BlsPublicKeys(ctx context.Context, in *QueryBlsPublicKeysRequest, opts ...grpc.CallOption) (*QueryBlsPublicKeysResponse, error) + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) } -func (m *QueryConfirmedCheckpointsResponse) Reset() { *m = QueryConfirmedCheckpointsResponse{} } -func (m *QueryConfirmedCheckpointsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryConfirmedCheckpointsResponse) ProtoMessage() {} -func (*QueryConfirmedCheckpointsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{11} -} -func (m *QueryConfirmedCheckpointsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryConfirmedCheckpointsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryConfirmedCheckpointsResponse.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 *QueryConfirmedCheckpointsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryConfirmedCheckpointsResponse.Merge(m, src) -} -func (m *QueryConfirmedCheckpointsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryConfirmedCheckpointsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryConfirmedCheckpointsResponse.DiscardUnknown(m) +type queryClient struct { + cc grpc1.ClientConn } -var xxx_messageInfo_QueryConfirmedCheckpointsResponse proto.InternalMessageInfo +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} -func (m *QueryConfirmedCheckpointsResponse) GetConfirmedCheckpoint() []*RawCheckpoint { - if m != nil { - return m.ConfirmedCheckpoint +func (c *queryClient) RawCheckpoints(ctx context.Context, in *QueryRawCheckpointsRequest, opts ...grpc.CallOption) (*QueryRawCheckpointsResponse, error) { + out := new(QueryRawCheckpointsResponse) + err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/RawCheckpoints", in, out, opts...) + if err != nil { + return nil, err } - return nil + return out, nil } -func (m *QueryConfirmedCheckpointsResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination +func (c *queryClient) RecentRawCheckpoints(ctx context.Context, in *QueryRecentRawCheckpointsRequest, opts ...grpc.CallOption) (*QueryRecentRawCheckpointsResponse, error) { + out := new(QueryRecentRawCheckpointsResponse) + err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/RecentRawCheckpoints", in, out, opts...) + if err != nil { + return nil, err } - return nil -} - -// QueryBlsSigsRequest is the request type for the Query/BlsSigs -// RPC method. -type QueryBlsSigsRequest struct { - // epoch_num defines the epoch for the queried bls sigs - EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryBlsSigsRequest) Reset() { *m = QueryBlsSigsRequest{} } -func (m *QueryBlsSigsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryBlsSigsRequest) ProtoMessage() {} -func (*QueryBlsSigsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{12} -} -func (m *QueryBlsSigsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryBlsSigsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryBlsSigsRequest.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 *QueryBlsSigsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBlsSigsRequest.Merge(m, src) -} -func (m *QueryBlsSigsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryBlsSigsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBlsSigsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryBlsSigsRequest proto.InternalMessageInfo - -func (m *QueryBlsSigsRequest) GetEpochNum() uint64 { - if m != nil { - return m.EpochNum - } - return 0 -} - -func (m *QueryBlsSigsRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryBlsSigsResponse is the response type for the Query/BlsSigs -// RPC method. -type QueryBlsSigsResponse struct { - BlsSigs []*BlsSig `protobuf:"bytes,1,rep,name=bls_sigs,json=blsSigs,proto3" json:"bls_sigs,omitempty"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryBlsSigsResponse) Reset() { *m = QueryBlsSigsResponse{} } -func (m *QueryBlsSigsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryBlsSigsResponse) ProtoMessage() {} -func (*QueryBlsSigsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{13} -} -func (m *QueryBlsSigsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryBlsSigsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryBlsSigsResponse.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 *QueryBlsSigsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBlsSigsResponse.Merge(m, src) -} -func (m *QueryBlsSigsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryBlsSigsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBlsSigsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryBlsSigsResponse proto.InternalMessageInfo - -func (m *QueryBlsSigsResponse) GetBlsSigs() []*BlsSig { - if m != nil { - return m.BlsSigs - } - return nil -} - -func (m *QueryBlsSigsResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryParamsRequest is request type for the Query/Params 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_a0fdb8f0f85bb51e, []int{14} -} -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 response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // params holds all the parameters of this module. - 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_a0fdb8f0f85bb51e, []int{15} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func init() { - proto.RegisterType((*QueryRawCheckpointsRequest)(nil), "babylon.checkpointing.v1.QueryRawCheckpointsRequest") - proto.RegisterType((*QueryRawCheckpointsResponse)(nil), "babylon.checkpointing.v1.QueryRawCheckpointsResponse") - proto.RegisterType((*QueryRawCheckpointRequest)(nil), "babylon.checkpointing.v1.QueryRawCheckpointRequest") - proto.RegisterType((*QueryRawCheckpointResponse)(nil), "babylon.checkpointing.v1.QueryRawCheckpointResponse") - proto.RegisterType((*QueryLatestCheckpointRequest)(nil), "babylon.checkpointing.v1.QueryLatestCheckpointRequest") - proto.RegisterType((*QueryLatestCheckpointResponse)(nil), "babylon.checkpointing.v1.QueryLatestCheckpointResponse") - proto.RegisterType((*QueryUncheckpointedCheckpointsRequest)(nil), "babylon.checkpointing.v1.QueryUncheckpointedCheckpointsRequest") - proto.RegisterType((*QueryUncheckpointedCheckpointsResponse)(nil), "babylon.checkpointing.v1.QueryUncheckpointedCheckpointsResponse") - proto.RegisterType((*QueryUnderconfirmedCheckpointsRequest)(nil), "babylon.checkpointing.v1.QueryUnderconfirmedCheckpointsRequest") - proto.RegisterType((*QueryUnderconfirmedCheckpointsResponse)(nil), "babylon.checkpointing.v1.QueryUnderconfirmedCheckpointsResponse") - proto.RegisterType((*QueryConfirmedCheckpointsRequest)(nil), "babylon.checkpointing.v1.QueryConfirmedCheckpointsRequest") - proto.RegisterType((*QueryConfirmedCheckpointsResponse)(nil), "babylon.checkpointing.v1.QueryConfirmedCheckpointsResponse") - proto.RegisterType((*QueryBlsSigsRequest)(nil), "babylon.checkpointing.v1.QueryBlsSigsRequest") - proto.RegisterType((*QueryBlsSigsResponse)(nil), "babylon.checkpointing.v1.QueryBlsSigsResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "babylon.checkpointing.v1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "babylon.checkpointing.v1.QueryParamsResponse") -} - -func init() { proto.RegisterFile("babylon/checkpointing/query.proto", fileDescriptor_a0fdb8f0f85bb51e) } - -var fileDescriptor_a0fdb8f0f85bb51e = []byte{ - // 872 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xcf, 0x53, 0xdb, 0x46, - 0x18, 0xf5, 0x52, 0x0a, 0x74, 0x29, 0x2e, 0x5d, 0x7c, 0x30, 0x82, 0xba, 0x46, 0xd3, 0x82, 0xa7, - 0x2d, 0x52, 0xcd, 0xcf, 0x0e, 0x30, 0x6d, 0xc7, 0x4c, 0xdb, 0x4b, 0x87, 0x52, 0xb7, 0x5c, 0xb8, - 0x78, 0x24, 0x23, 0x64, 0xb5, 0xb6, 0x56, 0x68, 0x25, 0x28, 0x65, 0x72, 0xc9, 0x31, 0x97, 0x64, - 0x26, 0xd7, 0x1c, 0xf2, 0x67, 0x70, 0xcd, 0xcd, 0x47, 0x66, 0x72, 0x48, 0x0e, 0x99, 0x4c, 0x06, - 0xf2, 0x7f, 0x24, 0xe3, 0xd5, 0x0a, 0xb3, 0x46, 0x6b, 0xc9, 0xe0, 0x70, 0x13, 0xbb, 0xdf, 0xf7, - 0xbe, 0xf7, 0x9e, 0x96, 0x7d, 0x32, 0x9c, 0xd1, 0x35, 0xfd, 0xb8, 0x8e, 0x6d, 0xb5, 0x5a, 0x33, - 0xaa, 0xff, 0x3a, 0xd8, 0xb2, 0x3d, 0xcb, 0x36, 0xd5, 0x03, 0xdf, 0x70, 0x8f, 0x15, 0xc7, 0xc5, - 0x1e, 0x46, 0x59, 0x56, 0xa2, 0x70, 0x25, 0xca, 0x61, 0x51, 0xfa, 0xa6, 0x8a, 0x49, 0x03, 0x13, - 0x55, 0xd7, 0x88, 0x11, 0xb4, 0xa8, 0x87, 0x45, 0xdd, 0xf0, 0xb4, 0xa2, 0xea, 0x68, 0xa6, 0x65, - 0x6b, 0x9e, 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 0x91, - 0x17, 0xbb, 0x15, 0x34, 0x97, 0x87, 0xf5, 0x00, 0xa4, 0x7f, 0xd6, 0x64, 0x20, 0xa2, 0xec, 0xb6, - 0x69, 0x56, 0x87, 0x97, 0xee, 0x0e, 0x33, 0x2c, 0x5c, 0x65, 0x94, 0x7f, 0x84, 0x43, 0x41, 0xa6, - 0xb3, 0x63, 0xd5, 0x85, 0x70, 0xd0, 0x59, 0x1a, 0x6c, 0xbe, 0xfe, 0x32, 0x55, 0x66, 0x5d, 0x0b, - 0xef, 0x46, 0xe1, 0xc7, 0x14, 0x17, 0x3d, 0x03, 0x30, 0xcd, 0x67, 0x2a, 0x5a, 0x12, 0x83, 0x89, - 0xbf, 0x07, 0xa4, 0xe5, 0x1e, 0xbb, 0x02, 0x25, 0x72, 0xe9, 0xfe, 0xf3, 0xb7, 0x8f, 0x07, 0x36, - 0xd0, 0x9a, 0x1a, 0xfd, 0x59, 0x72, 0x58, 0x54, 0x3b, 0x82, 0x5d, 0x3d, 0xe1, 0xbf, 0x3b, 0xee, - 0xa1, 0x53, 0x00, 0xc7, 0x38, 0x78, 0xb4, 0xd8, 0x0b, 0x99, 0x50, 0xc1, 0x52, 0x6f, 0x4d, 0x4c, - 0xc0, 0x06, 0x15, 0xb0, 0x82, 0x96, 0x92, 0x0a, 0x50, 0x4f, 0x78, 0xea, 0xe3, 0x9d, 0x81, 0x8a, - 0x56, 0x62, 0x88, 0x08, 0x12, 0x5a, 0x5a, 0xed, 0xb9, 0x8f, 0x69, 0x58, 0xa4, 0x1a, 0xe6, 0xd1, - 0xb7, 0x62, 0x0d, 0xd7, 0x92, 0x1d, 0xbd, 0x02, 0x70, 0x52, 0x18, 0x91, 0xe8, 0xa7, 0x18, 0x2e, - 0x71, 0x71, 0x2e, 0xfd, 0x7c, 0x73, 0x80, 0xe4, 0x6f, 0x46, 0x98, 0xde, 0x84, 0xc9, 0x13, 0xc4, - 0x56, 0x02, 0x79, 0xdd, 0x23, 0x36, 0x81, 0xbc, 0x98, 0xc4, 0x4c, 0x26, 0x4f, 0x90, 0xa8, 0x04, - 0x35, 0x01, 0xcc, 0x44, 0xe5, 0x09, 0x5a, 0x8b, 0x21, 0xd6, 0x25, 0xf1, 0xa4, 0xf5, 0x1b, 0xf5, - 0x32, 0x3d, 0xab, 0x54, 0x4f, 0x11, 0xa9, 0x62, 0x3d, 0xd1, 0x52, 0x9e, 0x02, 0x38, 0xcc, 0xee, - 0x74, 0x34, 0x1f, 0xc3, 0x80, 0x0f, 0x1e, 0x49, 0x49, 0x5a, 0xce, 0x38, 0xae, 0x50, 0x8e, 0xdf, - 0x23, 0x45, 0xcc, 0x31, 0x8c, 0x12, 0xee, 0xdf, 0xfc, 0x21, 0x80, 0x43, 0xc1, 0x45, 0x8c, 0xbe, - 0x8b, 0x19, 0xc9, 0xdd, 0xff, 0xd2, 0x7c, 0xc2, 0x6a, 0xc6, 0xaf, 0x40, 0xf9, 0xc9, 0x28, 0x2f, - 0xe6, 0x17, 0x24, 0x40, 0xe9, 0x8f, 0xe6, 0x79, 0x0e, 0x9c, 0x9d, 0xe7, 0xc0, 0x9b, 0xf3, 0x1c, - 0x78, 0x74, 0x91, 0x4b, 0x9d, 0x5d, 0xe4, 0x52, 0x2f, 0x2f, 0x72, 0xa9, 0xdd, 0x65, 0xd3, 0xf2, - 0x6a, 0xbe, 0xae, 0x54, 0x71, 0x23, 0x44, 0xa9, 0xd6, 0x34, 0xcb, 0xbe, 0x84, 0xfc, 0xaf, 0x03, - 0xd4, 0x3b, 0x76, 0x0c, 0xa2, 0x0f, 0xd1, 0x5f, 0x8d, 0x8b, 0xef, 0x03, 0x00, 0x00, 0xff, 0xff, - 0xcc, 0x8b, 0x6b, 0xad, 0x20, 0x0f, 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 { - // RawCheckpoints queries a list of checkpoints starting from a given epoch number to the current epoch number. - RawCheckpoints(ctx context.Context, in *QueryRawCheckpointsRequest, opts ...grpc.CallOption) (*QueryRawCheckpointsResponse, error) - // RawCheckpoint queries a checkpoints at a given epoch number. - RawCheckpoint(ctx context.Context, in *QueryRawCheckpointRequest, opts ...grpc.CallOption) (*QueryRawCheckpointResponse, error) - // LatestCheckpoint queries the latest checkpoint. - LatestCheckpoint(ctx context.Context, in *QueryLatestCheckpointRequest, opts ...grpc.CallOption) (*QueryLatestCheckpointResponse, error) - // UncheckpointedCheckpoints queries a list of checkpoints with the status of UNCHECKPOINTED. - UncheckpointedCheckpoints(ctx context.Context, in *QueryUncheckpointedCheckpointsRequest, opts ...grpc.CallOption) (*QueryUncheckpointedCheckpointsResponse, error) - // UnderconfirmedCheckpoints queries a list of checkpoints with the status of CHECKPOINTED_NOT_CONFIRMED. - UnderconfirmedCheckpoints(ctx context.Context, in *QueryUnderconfirmedCheckpointsRequest, opts ...grpc.CallOption) (*QueryUnderconfirmedCheckpointsResponse, error) - // ConfirmedCheckpoints queries a list of checkpoints with the status of CONFIRMED. - ConfirmedCheckpoints(ctx context.Context, in *QueryConfirmedCheckpointsRequest, opts ...grpc.CallOption) (*QueryConfirmedCheckpointsResponse, error) - // BlsSigs queries a list of bls sigs of the validators at a given epoch number. - BlsSigs(ctx context.Context, in *QueryBlsSigsRequest, opts ...grpc.CallOption) (*QueryBlsSigsResponse, error) - // Parameters queries the parameters of the module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) RawCheckpoints(ctx context.Context, in *QueryRawCheckpointsRequest, opts ...grpc.CallOption) (*QueryRawCheckpointsResponse, error) { - out := new(QueryRawCheckpointsResponse) - err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/RawCheckpoints", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil + return out, nil } func (c *queryClient) RawCheckpoint(ctx context.Context, in *QueryRawCheckpointRequest, opts ...grpc.CallOption) (*QueryRawCheckpointResponse, error) { @@ -971,36 +765,9 @@ func (c *queryClient) LatestCheckpoint(ctx context.Context, in *QueryLatestCheck return out, nil } -func (c *queryClient) UncheckpointedCheckpoints(ctx context.Context, in *QueryUncheckpointedCheckpointsRequest, opts ...grpc.CallOption) (*QueryUncheckpointedCheckpointsResponse, error) { - out := new(QueryUncheckpointedCheckpointsResponse) - err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/UncheckpointedCheckpoints", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) UnderconfirmedCheckpoints(ctx context.Context, in *QueryUnderconfirmedCheckpointsRequest, opts ...grpc.CallOption) (*QueryUnderconfirmedCheckpointsResponse, error) { - out := new(QueryUnderconfirmedCheckpointsResponse) - err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/UnderconfirmedCheckpoints", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ConfirmedCheckpoints(ctx context.Context, in *QueryConfirmedCheckpointsRequest, opts ...grpc.CallOption) (*QueryConfirmedCheckpointsResponse, error) { - out := new(QueryConfirmedCheckpointsResponse) - err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/ConfirmedCheckpoints", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) BlsSigs(ctx context.Context, in *QueryBlsSigsRequest, opts ...grpc.CallOption) (*QueryBlsSigsResponse, error) { - out := new(QueryBlsSigsResponse) - err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/BlsSigs", in, out, opts...) +func (c *queryClient) BlsPublicKeys(ctx context.Context, in *QueryBlsPublicKeysRequest, opts ...grpc.CallOption) (*QueryBlsPublicKeysResponse, error) { + out := new(QueryBlsPublicKeysResponse) + err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/BlsPublicKeys", in, out, opts...) if err != nil { return nil, err } @@ -1018,20 +785,16 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . // QueryServer is the server API for Query service. type QueryServer interface { - // RawCheckpoints queries a list of checkpoints starting from a given epoch number to the current epoch number. + // RawCheckpoints queries all checkpoints that match the given status. RawCheckpoints(context.Context, *QueryRawCheckpointsRequest) (*QueryRawCheckpointsResponse, error) + // RawCheckpoints queries a list of checkpoints starting from a given epoch number to the current epoch number. + RecentRawCheckpoints(context.Context, *QueryRecentRawCheckpointsRequest) (*QueryRecentRawCheckpointsResponse, error) // RawCheckpoint queries a checkpoints at a given epoch number. RawCheckpoint(context.Context, *QueryRawCheckpointRequest) (*QueryRawCheckpointResponse, error) // LatestCheckpoint queries the latest checkpoint. LatestCheckpoint(context.Context, *QueryLatestCheckpointRequest) (*QueryLatestCheckpointResponse, error) - // UncheckpointedCheckpoints queries a list of checkpoints with the status of UNCHECKPOINTED. - UncheckpointedCheckpoints(context.Context, *QueryUncheckpointedCheckpointsRequest) (*QueryUncheckpointedCheckpointsResponse, error) - // UnderconfirmedCheckpoints queries a list of checkpoints with the status of CHECKPOINTED_NOT_CONFIRMED. - UnderconfirmedCheckpoints(context.Context, *QueryUnderconfirmedCheckpointsRequest) (*QueryUnderconfirmedCheckpointsResponse, error) - // ConfirmedCheckpoints queries a list of checkpoints with the status of CONFIRMED. - ConfirmedCheckpoints(context.Context, *QueryConfirmedCheckpointsRequest) (*QueryConfirmedCheckpointsResponse, error) - // BlsSigs queries a list of bls sigs of the validators at a given epoch number. - BlsSigs(context.Context, *QueryBlsSigsRequest) (*QueryBlsSigsResponse, error) + // BlsPublicKeys queries a list of bls public keys of the validators at a given epoch number. + BlsPublicKeys(context.Context, *QueryBlsPublicKeysRequest) (*QueryBlsPublicKeysResponse, error) // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) } @@ -1043,23 +806,17 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) RawCheckpoints(ctx context.Context, req *QueryRawCheckpointsRequest) (*QueryRawCheckpointsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RawCheckpoints not implemented") } +func (*UnimplementedQueryServer) RecentRawCheckpoints(ctx context.Context, req *QueryRecentRawCheckpointsRequest) (*QueryRecentRawCheckpointsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RecentRawCheckpoints not implemented") +} func (*UnimplementedQueryServer) RawCheckpoint(ctx context.Context, req *QueryRawCheckpointRequest) (*QueryRawCheckpointResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RawCheckpoint not implemented") } func (*UnimplementedQueryServer) LatestCheckpoint(ctx context.Context, req *QueryLatestCheckpointRequest) (*QueryLatestCheckpointResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method LatestCheckpoint not implemented") } -func (*UnimplementedQueryServer) UncheckpointedCheckpoints(ctx context.Context, req *QueryUncheckpointedCheckpointsRequest) (*QueryUncheckpointedCheckpointsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UncheckpointedCheckpoints not implemented") -} -func (*UnimplementedQueryServer) UnderconfirmedCheckpoints(ctx context.Context, req *QueryUnderconfirmedCheckpointsRequest) (*QueryUnderconfirmedCheckpointsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UnderconfirmedCheckpoints not implemented") -} -func (*UnimplementedQueryServer) ConfirmedCheckpoints(ctx context.Context, req *QueryConfirmedCheckpointsRequest) (*QueryConfirmedCheckpointsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ConfirmedCheckpoints not implemented") -} -func (*UnimplementedQueryServer) BlsSigs(ctx context.Context, req *QueryBlsSigsRequest) (*QueryBlsSigsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method BlsSigs not implemented") +func (*UnimplementedQueryServer) BlsPublicKeys(ctx context.Context, req *QueryBlsPublicKeysRequest) (*QueryBlsPublicKeysResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BlsPublicKeys not implemented") } func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") @@ -1087,128 +844,92 @@ func _Query_RawCheckpoints_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } -func _Query_RawCheckpoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRawCheckpointRequest) +func _Query_RecentRawCheckpoints_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRecentRawCheckpointsRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).RawCheckpoint(ctx, in) + return srv.(QueryServer).RecentRawCheckpoints(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/babylon.checkpointing.v1.Query/RawCheckpoint", + FullMethod: "/babylon.checkpointing.v1.Query/RecentRawCheckpoints", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).RawCheckpoint(ctx, req.(*QueryRawCheckpointRequest)) + return srv.(QueryServer).RecentRawCheckpoints(ctx, req.(*QueryRecentRawCheckpointsRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_LatestCheckpoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryLatestCheckpointRequest) +func _Query_RawCheckpoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRawCheckpointRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).LatestCheckpoint(ctx, in) + return srv.(QueryServer).RawCheckpoint(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/babylon.checkpointing.v1.Query/LatestCheckpoint", + FullMethod: "/babylon.checkpointing.v1.Query/RawCheckpoint", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).LatestCheckpoint(ctx, req.(*QueryLatestCheckpointRequest)) + return srv.(QueryServer).RawCheckpoint(ctx, req.(*QueryRawCheckpointRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_UncheckpointedCheckpoints_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryUncheckpointedCheckpointsRequest) +func _Query_LatestCheckpoint_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryLatestCheckpointRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).UncheckpointedCheckpoints(ctx, in) + return srv.(QueryServer).LatestCheckpoint(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/babylon.checkpointing.v1.Query/UncheckpointedCheckpoints", + FullMethod: "/babylon.checkpointing.v1.Query/LatestCheckpoint", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).UncheckpointedCheckpoints(ctx, req.(*QueryUncheckpointedCheckpointsRequest)) + return srv.(QueryServer).LatestCheckpoint(ctx, req.(*QueryLatestCheckpointRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_UnderconfirmedCheckpoints_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryUnderconfirmedCheckpointsRequest) +func _Query_BlsPublicKeys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBlsPublicKeysRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).UnderconfirmedCheckpoints(ctx, in) + return srv.(QueryServer).BlsPublicKeys(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/babylon.checkpointing.v1.Query/UnderconfirmedCheckpoints", + FullMethod: "/babylon.checkpointing.v1.Query/BlsPublicKeys", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).UnderconfirmedCheckpoints(ctx, req.(*QueryUnderconfirmedCheckpointsRequest)) + return srv.(QueryServer).BlsPublicKeys(ctx, req.(*QueryBlsPublicKeysRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_ConfirmedCheckpoints_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryConfirmedCheckpointsRequest) +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).ConfirmedCheckpoints(ctx, in) + return srv.(QueryServer).Params(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/babylon.checkpointing.v1.Query/ConfirmedCheckpoints", + FullMethod: "/babylon.checkpointing.v1.Query/Params", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ConfirmedCheckpoints(ctx, req.(*QueryConfirmedCheckpointsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_BlsSigs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryBlsSigsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).BlsSigs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/babylon.checkpointing.v1.Query/BlsSigs", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).BlsSigs(ctx, req.(*QueryBlsSigsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -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: "/babylon.checkpointing.v1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) } return interceptor(ctx, in, info, handler) } @@ -1221,6 +942,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "RawCheckpoints", Handler: _Query_RawCheckpoints_Handler, }, + { + MethodName: "RecentRawCheckpoints", + Handler: _Query_RecentRawCheckpoints_Handler, + }, { MethodName: "RawCheckpoint", Handler: _Query_RawCheckpoint_Handler, @@ -1230,20 +955,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_LatestCheckpoint_Handler, }, { - MethodName: "UncheckpointedCheckpoints", - Handler: _Query_UncheckpointedCheckpoints_Handler, - }, - { - MethodName: "UnderconfirmedCheckpoints", - Handler: _Query_UnderconfirmedCheckpoints_Handler, - }, - { - MethodName: "ConfirmedCheckpoints", - Handler: _Query_ConfirmedCheckpoints_Handler, - }, - { - MethodName: "BlsSigs", - Handler: _Query_BlsSigs_Handler, + MethodName: "BlsPublicKeys", + Handler: _Query_BlsPublicKeys_Handler, }, { MethodName: "Params", @@ -1286,10 +999,12 @@ func (m *QueryRawCheckpointsRequest) MarshalToSizedBuffer(dAtA []byte) (int, err i-- dAtA[i] = 0x12 } - if m.FromEpochNum != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.FromEpochNum)) + if len(m.Status) > 0 { + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Status))) i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -1343,128 +1058,7 @@ func (m *QueryRawCheckpointsResponse) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } -func (m *QueryRawCheckpointRequest) 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 *QueryRawCheckpointRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRawCheckpointRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.EpochNum != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.EpochNum)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryRawCheckpointResponse) 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 *QueryRawCheckpointResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRawCheckpointResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.RawCheckpoint != nil { - { - size, err := m.RawCheckpoint.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 *QueryLatestCheckpointRequest) 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 *QueryLatestCheckpointRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryLatestCheckpointRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryLatestCheckpointResponse) 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 *QueryLatestCheckpointResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryLatestCheckpointResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.LatestCheckpoint != nil { - { - size, err := m.LatestCheckpoint.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 *QueryUncheckpointedCheckpointsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryRecentRawCheckpointsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1474,12 +1068,12 @@ func (m *QueryUncheckpointedCheckpointsRequest) Marshal() (dAtA []byte, err erro return dAtA[:n], nil } -func (m *QueryUncheckpointedCheckpointsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryRecentRawCheckpointsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryUncheckpointedCheckpointsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryRecentRawCheckpointsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1494,12 +1088,17 @@ func (m *QueryUncheckpointedCheckpointsRequest) MarshalToSizedBuffer(dAtA []byte i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + if m.FromEpochNum != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.FromEpochNum)) + i-- + dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *QueryUncheckpointedCheckpointsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryRecentRawCheckpointsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1509,12 +1108,12 @@ func (m *QueryUncheckpointedCheckpointsResponse) Marshal() (dAtA []byte, err err return dAtA[:n], nil } -func (m *QueryUncheckpointedCheckpointsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryRecentRawCheckpointsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryUncheckpointedCheckpointsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryRecentRawCheckpointsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1531,10 +1130,10 @@ func (m *QueryUncheckpointedCheckpointsResponse) MarshalToSizedBuffer(dAtA []byt i-- dAtA[i] = 0x12 } - if len(m.UncheckpointedCheckpoint) > 0 { - for iNdEx := len(m.UncheckpointedCheckpoint) - 1; iNdEx >= 0; iNdEx-- { + if len(m.RawCheckpoints) > 0 { + for iNdEx := len(m.RawCheckpoints) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.UncheckpointedCheckpoint[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.RawCheckpoints[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1548,7 +1147,7 @@ func (m *QueryUncheckpointedCheckpointsResponse) MarshalToSizedBuffer(dAtA []byt return len(dAtA) - i, nil } -func (m *QueryUnderconfirmedCheckpointsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryRawCheckpointRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1558,32 +1157,25 @@ func (m *QueryUnderconfirmedCheckpointsRequest) Marshal() (dAtA []byte, err erro return dAtA[:n], nil } -func (m *QueryUnderconfirmedCheckpointsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryRawCheckpointRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryUnderconfirmedCheckpointsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryRawCheckpointRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } + if m.EpochNum != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.EpochNum)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *QueryUnderconfirmedCheckpointsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryRawCheckpointResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1593,19 +1185,19 @@ func (m *QueryUnderconfirmedCheckpointsResponse) Marshal() (dAtA []byte, err err return dAtA[:n], nil } -func (m *QueryUnderconfirmedCheckpointsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryRawCheckpointResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryUnderconfirmedCheckpointsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryRawCheckpointResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Pagination != nil { + if m.RawCheckpoint != nil { { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.RawCheckpoint.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1613,26 +1205,12 @@ func (m *QueryUnderconfirmedCheckpointsResponse) MarshalToSizedBuffer(dAtA []byt i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - } - if len(m.UnderconfirmedCheckpoint) > 0 { - for iNdEx := len(m.UnderconfirmedCheckpoint) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.UnderconfirmedCheckpoint[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryConfirmedCheckpointsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryLatestCheckpointRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1642,32 +1220,20 @@ func (m *QueryConfirmedCheckpointsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryConfirmedCheckpointsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryLatestCheckpointRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryConfirmedCheckpointsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryLatestCheckpointRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.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 *QueryConfirmedCheckpointsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryLatestCheckpointResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1677,19 +1243,19 @@ func (m *QueryConfirmedCheckpointsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryConfirmedCheckpointsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryLatestCheckpointResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryConfirmedCheckpointsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryLatestCheckpointResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Pagination != nil { + if m.LatestCheckpoint != nil { { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.LatestCheckpoint.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1697,26 +1263,12 @@ func (m *QueryConfirmedCheckpointsResponse) MarshalToSizedBuffer(dAtA []byte) (i i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - } - if len(m.ConfirmedCheckpoint) > 0 { - for iNdEx := len(m.ConfirmedCheckpoint) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ConfirmedCheckpoint[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryBlsSigsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryBlsPublicKeysRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1726,12 +1278,12 @@ func (m *QueryBlsSigsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryBlsSigsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryBlsPublicKeysRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryBlsSigsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryBlsPublicKeysRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1756,7 +1308,7 @@ func (m *QueryBlsSigsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryBlsSigsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryBlsPublicKeysResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1766,12 +1318,12 @@ func (m *QueryBlsSigsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryBlsSigsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryBlsPublicKeysResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryBlsSigsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryBlsPublicKeysResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1788,16 +1340,11 @@ func (m *QueryBlsSigsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.BlsSigs) > 0 { - for iNdEx := len(m.BlsSigs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.BlsSigs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } + if len(m.BlsPubKeys) > 0 { + for iNdEx := len(m.BlsPubKeys) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.BlsPubKeys[iNdEx]) + copy(dAtA[i:], m.BlsPubKeys[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BlsPubKeys[iNdEx]))) i-- dAtA[i] = 0xa } @@ -1878,8 +1425,9 @@ func (m *QueryRawCheckpointsRequest) Size() (n int) { } var l int _ = l - if m.FromEpochNum != 0 { - n += 1 + sovQuery(uint64(m.FromEpochNum)) + l = len(m.Status) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) } if m.Pagination != nil { l = m.Pagination.Size() @@ -1907,59 +1455,15 @@ func (m *QueryRawCheckpointsResponse) Size() (n int) { return n } -func (m *QueryRawCheckpointRequest) Size() (n int) { +func (m *QueryRecentRawCheckpointsRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.EpochNum != 0 { - n += 1 + sovQuery(uint64(m.EpochNum)) - } - return n -} - -func (m *QueryRawCheckpointResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RawCheckpoint != nil { - l = m.RawCheckpoint.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryLatestCheckpointRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryLatestCheckpointResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.LatestCheckpoint != nil { - l = m.LatestCheckpoint.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryUncheckpointedCheckpointsRequest) Size() (n int) { - if m == nil { - return 0 + if m.FromEpochNum != 0 { + n += 1 + sovQuery(uint64(m.FromEpochNum)) } - var l int - _ = l if m.Pagination != nil { l = m.Pagination.Size() n += 1 + l + sovQuery(uint64(l)) @@ -1967,14 +1471,14 @@ func (m *QueryUncheckpointedCheckpointsRequest) Size() (n int) { return n } -func (m *QueryUncheckpointedCheckpointsResponse) Size() (n int) { +func (m *QueryRecentRawCheckpointsResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.UncheckpointedCheckpoint) > 0 { - for _, e := range m.UncheckpointedCheckpoint { + if len(m.RawCheckpoints) > 0 { + for _, e := range m.RawCheckpoints { l = e.Size() n += 1 + l + sovQuery(uint64(l)) } @@ -1986,71 +1490,54 @@ func (m *QueryUncheckpointedCheckpointsResponse) Size() (n int) { return n } -func (m *QueryUnderconfirmedCheckpointsRequest) Size() (n int) { +func (m *QueryRawCheckpointRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) + if m.EpochNum != 0 { + n += 1 + sovQuery(uint64(m.EpochNum)) } return n } -func (m *QueryUnderconfirmedCheckpointsResponse) Size() (n int) { +func (m *QueryRawCheckpointResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.UnderconfirmedCheckpoint) > 0 { - for _, e := range m.UnderconfirmedCheckpoint { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() + if m.RawCheckpoint != nil { + l = m.RawCheckpoint.Size() n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryConfirmedCheckpointsRequest) Size() (n int) { +func (m *QueryLatestCheckpointRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } return n } -func (m *QueryConfirmedCheckpointsResponse) Size() (n int) { +func (m *QueryLatestCheckpointResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.ConfirmedCheckpoint) > 0 { - for _, e := range m.ConfirmedCheckpoint { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.Pagination != nil { - l = m.Pagination.Size() + if m.LatestCheckpoint != nil { + l = m.LatestCheckpoint.Size() n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *QueryBlsSigsRequest) Size() (n int) { +func (m *QueryBlsPublicKeysRequest) Size() (n int) { if m == nil { return 0 } @@ -2066,15 +1553,15 @@ func (m *QueryBlsSigsRequest) Size() (n int) { return n } -func (m *QueryBlsSigsResponse) Size() (n int) { +func (m *QueryBlsPublicKeysResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.BlsSigs) > 0 { - for _, e := range m.BlsSigs { - l = e.Size() + if len(m.BlsPubKeys) > 0 { + for _, b := range m.BlsPubKeys { + l = len(b) n += 1 + l + sovQuery(uint64(l)) } } @@ -2103,445 +1590,15 @@ func (m *QueryParamsResponse) Size() (n int) { l = m.Params.Size() n += 1 + l + sovQuery(uint64(l)) return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryRawCheckpointsRequest) 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: QueryRawCheckpointsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRawCheckpointsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FromEpochNum", wireType) - } - m.FromEpochNum = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.FromEpochNum |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryRawCheckpointsResponse) 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: QueryRawCheckpointsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRawCheckpointsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RawCheckpoints", 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.RawCheckpoints = append(m.RawCheckpoints, &RawCheckpoint{}) - if err := m.RawCheckpoints[len(m.RawCheckpoints)-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 Pagination", 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.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryRawCheckpointRequest) 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: QueryRawCheckpointRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRawCheckpointRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EpochNum", wireType) - } - m.EpochNum = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.EpochNum |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryRawCheckpointResponse) 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: QueryRawCheckpointResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRawCheckpointResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RawCheckpoint", 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.RawCheckpoint == nil { - m.RawCheckpoint = &RawCheckpoint{} - } - if err := m.RawCheckpoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryLatestCheckpointRequest) 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: QueryLatestCheckpointRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLatestCheckpointRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } +} - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 } -func (m *QueryLatestCheckpointResponse) Unmarshal(dAtA []byte) error { +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryRawCheckpointsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2564,17 +1621,17 @@ func (m *QueryLatestCheckpointResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryLatestCheckpointResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRawCheckpointsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLatestCheckpointResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRawCheckpointsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LatestCheckpoint", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -2584,79 +1641,25 @@ func (m *QueryLatestCheckpointResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.LatestCheckpoint == nil { - m.LatestCheckpoint = &RawCheckpoint{} - } - if err := m.LatestCheckpoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Status = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryUncheckpointedCheckpointsRequest) 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: QueryUncheckpointedCheckpointsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryUncheckpointedCheckpointsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } @@ -2713,7 +1716,7 @@ func (m *QueryUncheckpointedCheckpointsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryUncheckpointedCheckpointsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryRawCheckpointsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2736,15 +1739,15 @@ func (m *QueryUncheckpointedCheckpointsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryUncheckpointedCheckpointsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRawCheckpointsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryUncheckpointedCheckpointsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRawCheckpointsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UncheckpointedCheckpoint", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RawCheckpoints", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2771,8 +1774,8 @@ func (m *QueryUncheckpointedCheckpointsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.UncheckpointedCheckpoint = append(m.UncheckpointedCheckpoint, &RawCheckpoint{}) - if err := m.UncheckpointedCheckpoint[len(m.UncheckpointedCheckpoint)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.RawCheckpoints = append(m.RawCheckpoints, &RawCheckpoint{}) + if err := m.RawCheckpoints[len(m.RawCheckpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2833,7 +1836,7 @@ func (m *QueryUncheckpointedCheckpointsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryUnderconfirmedCheckpointsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryRecentRawCheckpointsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2856,13 +1859,32 @@ func (m *QueryUnderconfirmedCheckpointsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryUnderconfirmedCheckpointsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRecentRawCheckpointsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryUnderconfirmedCheckpointsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRecentRawCheckpointsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FromEpochNum", wireType) + } + m.FromEpochNum = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FromEpochNum |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } @@ -2919,7 +1941,7 @@ func (m *QueryUnderconfirmedCheckpointsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryUnderconfirmedCheckpointsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryRecentRawCheckpointsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2942,15 +1964,15 @@ func (m *QueryUnderconfirmedCheckpointsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryUnderconfirmedCheckpointsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRecentRawCheckpointsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryUnderconfirmedCheckpointsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRecentRawCheckpointsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnderconfirmedCheckpoint", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RawCheckpoints", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2977,8 +1999,8 @@ func (m *QueryUnderconfirmedCheckpointsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.UnderconfirmedCheckpoint = append(m.UnderconfirmedCheckpoint, &RawCheckpoint{}) - if err := m.UnderconfirmedCheckpoint[len(m.UnderconfirmedCheckpoint)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.RawCheckpoints = append(m.RawCheckpoints, &RawCheckpoint{}) + if err := m.RawCheckpoints[len(m.RawCheckpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3039,7 +2061,7 @@ func (m *QueryUnderconfirmedCheckpointsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryConfirmedCheckpointsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryRawCheckpointRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3062,17 +2084,17 @@ func (m *QueryConfirmedCheckpointsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConfirmedCheckpointsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRawCheckpointRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConfirmedCheckpointsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRawCheckpointRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochNum", wireType) } - var msglen int + m.EpochNum = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3082,28 +2104,11 @@ func (m *QueryConfirmedCheckpointsRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.EpochNum |= uint64(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.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3125,7 +2130,7 @@ func (m *QueryConfirmedCheckpointsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryConfirmedCheckpointsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryRawCheckpointResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3148,15 +2153,15 @@ func (m *QueryConfirmedCheckpointsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryConfirmedCheckpointsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRawCheckpointResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryConfirmedCheckpointsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRawCheckpointResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConfirmedCheckpoint", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RawCheckpoint", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3183,14 +2188,116 @@ func (m *QueryConfirmedCheckpointsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ConfirmedCheckpoint = append(m.ConfirmedCheckpoint, &RawCheckpoint{}) - if err := m.ConfirmedCheckpoint[len(m.ConfirmedCheckpoint)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.RawCheckpoint == nil { + m.RawCheckpoint = &RawCheckpoint{} + } + if err := m.RawCheckpoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 2: + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryLatestCheckpointRequest) 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: QueryLatestCheckpointRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLatestCheckpointRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryLatestCheckpointResponse) 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: QueryLatestCheckpointResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLatestCheckpointResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LatestCheckpoint", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3217,10 +2324,10 @@ func (m *QueryConfirmedCheckpointsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} + if m.LatestCheckpoint == nil { + m.LatestCheckpoint = &RawCheckpoint{} } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.LatestCheckpoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3245,7 +2352,7 @@ func (m *QueryConfirmedCheckpointsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryBlsSigsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryBlsPublicKeysRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3268,10 +2375,10 @@ func (m *QueryBlsSigsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryBlsSigsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBlsPublicKeysRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBlsSigsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryBlsPublicKeysRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3350,7 +2457,7 @@ func (m *QueryBlsSigsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryBlsSigsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryBlsPublicKeysResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3373,17 +2480,17 @@ func (m *QueryBlsSigsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryBlsSigsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBlsPublicKeysResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBlsSigsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryBlsPublicKeysResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlsSigs", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BlsPubKeys", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3393,25 +2500,23 @@ func (m *QueryBlsSigsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.BlsSigs = append(m.BlsSigs, &BlsSig{}) - if err := m.BlsSigs[len(m.BlsSigs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.BlsPubKeys = append(m.BlsPubKeys, make([]byte, postIndex-iNdEx)) + copy(m.BlsPubKeys[len(m.BlsPubKeys)-1], dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { diff --git a/x/checkpointing/types/query.pb.gw.go b/x/checkpointing/types/query.pb.gw.go index d35225ced..f51c438ba 100644 --- a/x/checkpointing/types/query.pb.gw.go +++ b/x/checkpointing/types/query.pb.gw.go @@ -32,7 +32,7 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var ( - filter_Query_RawCheckpoints_0 = &utilities.DoubleArray{Encoding: map[string]int{"from_epoch_num": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + filter_Query_RawCheckpoints_0 = &utilities.DoubleArray{Encoding: map[string]int{"status": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) func request_Query_RawCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -46,15 +46,15 @@ func request_Query_RawCheckpoints_0(ctx context.Context, marshaler runtime.Marsh _ = err ) - val, ok = pathParams["from_epoch_num"] + val, ok = pathParams["status"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "from_epoch_num") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status") } - protoReq.FromEpochNum, err = runtime.Uint64(val) + protoReq.Status, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "from_epoch_num", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status", err) } if err := req.ParseForm(); err != nil { @@ -80,15 +80,15 @@ func local_request_Query_RawCheckpoints_0(ctx context.Context, marshaler runtime _ = err ) - val, ok = pathParams["from_epoch_num"] + val, ok = pathParams["status"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "from_epoch_num") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status") } - protoReq.FromEpochNum, err = runtime.Uint64(val) + protoReq.Status, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "from_epoch_num", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status", err) } if err := req.ParseForm(); err != nil { @@ -103,8 +103,12 @@ func local_request_Query_RawCheckpoints_0(ctx context.Context, marshaler runtime } -func request_Query_RawCheckpoint_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRawCheckpointRequest +var ( + filter_Query_RecentRawCheckpoints_0 = &utilities.DoubleArray{Encoding: map[string]int{"from_epoch_num": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_RecentRawCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRecentRawCheckpointsRequest var metadata runtime.ServerMetadata var ( @@ -114,24 +118,31 @@ func request_Query_RawCheckpoint_0(ctx context.Context, marshaler runtime.Marsha _ = err ) - val, ok = pathParams["epoch_num"] + val, ok = pathParams["from_epoch_num"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_num") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "from_epoch_num") } - protoReq.EpochNum, err = runtime.Uint64(val) + protoReq.FromEpochNum, err = runtime.Uint64(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_num", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "from_epoch_num", err) } - msg, err := client.RawCheckpoint(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RecentRawCheckpoints_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RecentRawCheckpoints(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_RawCheckpoint_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRawCheckpointRequest +func local_request_Query_RecentRawCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRecentRawCheckpointsRequest var metadata runtime.ServerMetadata var ( @@ -141,154 +152,107 @@ func local_request_Query_RawCheckpoint_0(ctx context.Context, marshaler runtime. _ = err ) - val, ok = pathParams["epoch_num"] + val, ok = pathParams["from_epoch_num"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_num") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "from_epoch_num") } - protoReq.EpochNum, err = runtime.Uint64(val) + protoReq.FromEpochNum, err = runtime.Uint64(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_num", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "from_epoch_num", err) } - msg, err := server.RawCheckpoint(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_LatestCheckpoint_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLatestCheckpointRequest - var metadata runtime.ServerMetadata - - msg, err := client.LatestCheckpoint(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_LatestCheckpoint_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryLatestCheckpointRequest - var metadata runtime.ServerMetadata - - msg, err := server.LatestCheckpoint(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_UncheckpointedCheckpoints_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_UncheckpointedCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryUncheckpointedCheckpointsRequest - var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_UncheckpointedCheckpoints_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RecentRawCheckpoints_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.UncheckpointedCheckpoints(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := server.RecentRawCheckpoints(ctx, &protoReq) return msg, metadata, err } -func local_request_Query_UncheckpointedCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryUncheckpointedCheckpointsRequest +func request_Query_RawCheckpoint_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRawCheckpointRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_UncheckpointedCheckpoints_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.UncheckpointedCheckpoints(ctx, &protoReq) - return msg, metadata, err - -} + var ( + val string + ok bool + err error + _ = err + ) -var ( - filter_Query_UnderconfirmedCheckpoints_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) + val, ok = pathParams["epoch_num"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_num") + } -func request_Query_UnderconfirmedCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryUnderconfirmedCheckpointsRequest - var metadata runtime.ServerMetadata + protoReq.EpochNum, err = runtime.Uint64(val) - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_UnderconfirmedCheckpoints_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_num", err) } - msg, err := client.UnderconfirmedCheckpoints(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.RawCheckpoint(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_UnderconfirmedCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryUnderconfirmedCheckpointsRequest +func local_request_Query_RawCheckpoint_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRawCheckpointRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["epoch_num"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_num") } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_UnderconfirmedCheckpoints_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + + protoReq.EpochNum, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_num", err) } - msg, err := server.UnderconfirmedCheckpoints(ctx, &protoReq) + msg, err := server.RawCheckpoint(ctx, &protoReq) return msg, metadata, err } -var ( - filter_Query_ConfirmedCheckpoints_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_ConfirmedCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryConfirmedCheckpointsRequest +func request_Query_LatestCheckpoint_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLatestCheckpointRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ConfirmedCheckpoints_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ConfirmedCheckpoints(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.LatestCheckpoint(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_ConfirmedCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryConfirmedCheckpointsRequest +func local_request_Query_LatestCheckpoint_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLatestCheckpointRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ConfirmedCheckpoints_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ConfirmedCheckpoints(ctx, &protoReq) + msg, err := server.LatestCheckpoint(ctx, &protoReq) return msg, metadata, err } var ( - filter_Query_BlsSigs_0 = &utilities.DoubleArray{Encoding: map[string]int{"epoch_num": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + filter_Query_BlsPublicKeys_0 = &utilities.DoubleArray{Encoding: map[string]int{"epoch_num": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) -func request_Query_BlsSigs_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryBlsSigsRequest +func request_Query_BlsPublicKeys_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBlsPublicKeysRequest var metadata runtime.ServerMetadata var ( @@ -312,17 +276,17 @@ func request_Query_BlsSigs_0(ctx context.Context, marshaler runtime.Marshaler, c if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BlsSigs_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BlsPublicKeys_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.BlsSigs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.BlsPublicKeys(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_BlsSigs_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryBlsSigsRequest +func local_request_Query_BlsPublicKeys_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBlsPublicKeysRequest var metadata runtime.ServerMetadata var ( @@ -346,11 +310,11 @@ func local_request_Query_BlsSigs_0(ctx context.Context, marshaler runtime.Marsha if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BlsSigs_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BlsPublicKeys_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.BlsSigs(ctx, &protoReq) + msg, err := server.BlsPublicKeys(ctx, &protoReq) return msg, metadata, err } @@ -399,47 +363,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_RawCheckpoint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_RawCheckpoint_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_RawCheckpoint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_LatestCheckpoint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_LatestCheckpoint_0(rctx, inboundMarshaler, server, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_LatestCheckpoint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_UncheckpointedCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RecentRawCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -448,18 +372,18 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_UncheckpointedCheckpoints_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_RecentRawCheckpoints_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_UncheckpointedCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RecentRawCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_UnderconfirmedCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RawCheckpoint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -468,18 +392,18 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_UnderconfirmedCheckpoints_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_RawCheckpoint_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_UnderconfirmedCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RawCheckpoint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ConfirmedCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_LatestCheckpoint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -488,18 +412,18 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_ConfirmedCheckpoints_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_LatestCheckpoint_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_ConfirmedCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_LatestCheckpoint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_BlsSigs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_BlsPublicKeys_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -508,14 +432,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_BlsSigs_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_BlsPublicKeys_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_BlsSigs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_BlsPublicKeys_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -600,47 +524,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_RawCheckpoint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_RawCheckpoint_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_RawCheckpoint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_LatestCheckpoint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_LatestCheckpoint_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_LatestCheckpoint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_UncheckpointedCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RecentRawCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -649,18 +533,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_UncheckpointedCheckpoints_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_RecentRawCheckpoints_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_UncheckpointedCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RecentRawCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_UnderconfirmedCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RawCheckpoint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -669,18 +553,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_UnderconfirmedCheckpoints_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_RawCheckpoint_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_UnderconfirmedCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RawCheckpoint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ConfirmedCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_LatestCheckpoint_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -689,18 +573,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_ConfirmedCheckpoints_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_LatestCheckpoint_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_ConfirmedCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_LatestCheckpoint_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_BlsSigs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_BlsPublicKeys_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -709,14 +593,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_BlsSigs_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_BlsPublicKeys_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_BlsSigs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_BlsPublicKeys_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -744,19 +628,15 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_RawCheckpoints_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "checkpointing", "v1", "raw_checkpoints", "from_epoch_num"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_RawCheckpoints_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "checkpointing", "v1", "raw_checkpoints", "status"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_RecentRawCheckpoints_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "checkpointing", "v1", "recent_raw_checkpoints", "from_epoch_num"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_RawCheckpoint_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "checkpointing", "v1", "raw_checkpoint", "epoch_num"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_LatestCheckpoint_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "checkpointing", "v1", "latest_checkpoint"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_UncheckpointedCheckpoints_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "checkpointing", "v1", "uncheckpointed_checkpoints"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_UnderconfirmedCheckpoints_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "checkpointing", "v1", "underconfirmed_checkpoints"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_ConfirmedCheckpoints_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "checkpointing", "v1", "confirmed_checkpoints"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_BlsSigs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "checkpointing", "v1", "bls_sigs", "epoch_num"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_BlsPublicKeys_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "checkpointing", "v1", "bls_public_keys", "epoch_num"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "checkpointing", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) ) @@ -764,17 +644,13 @@ var ( var ( forward_Query_RawCheckpoints_0 = runtime.ForwardResponseMessage + forward_Query_RecentRawCheckpoints_0 = runtime.ForwardResponseMessage + forward_Query_RawCheckpoint_0 = runtime.ForwardResponseMessage forward_Query_LatestCheckpoint_0 = runtime.ForwardResponseMessage - forward_Query_UncheckpointedCheckpoints_0 = runtime.ForwardResponseMessage - - forward_Query_UnderconfirmedCheckpoints_0 = runtime.ForwardResponseMessage - - forward_Query_ConfirmedCheckpoints_0 = runtime.ForwardResponseMessage - - forward_Query_BlsSigs_0 = runtime.ForwardResponseMessage + forward_Query_BlsPublicKeys_0 = runtime.ForwardResponseMessage forward_Query_Params_0 = runtime.ForwardResponseMessage ) From 1bbcfcb0faf260ea36d442d475953d747056c713 Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Tue, 14 Jun 2022 10:59:41 +0800 Subject: [PATCH 05/16] integrated checkpointing module into simapp --- app/app.go | 14 ++++++++++++++ app/app_test.go | 3 +++ x/checkpointing/keeper/keeper.go | 27 +++++++++++++++++++-------- x/checkpointing/module.go | 4 ++++ 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/app/app.go b/app/app.go index 4e1bf75c1..b49beb868 100644 --- a/app/app.go +++ b/app/app.go @@ -101,6 +101,9 @@ import ( "github.com/babylonchain/babylon/x/btclightclient" btclightclientkeeper "github.com/babylonchain/babylon/x/btclightclient/keeper" btclightclienttypes "github.com/babylonchain/babylon/x/btclightclient/types" + "github.com/babylonchain/babylon/x/checkpointing" + checkpointingkeeper "github.com/babylonchain/babylon/x/checkpointing/keeper" + checkpointingtypes "github.com/babylonchain/babylon/x/checkpointing/types" "github.com/babylonchain/babylon/x/epoching" epochingkeeper "github.com/babylonchain/babylon/x/epoching/keeper" epochingtypes "github.com/babylonchain/babylon/x/epoching/types" @@ -136,6 +139,7 @@ var ( vesting.AppModuleBasic{}, btclightclient.AppModuleBasic{}, btccheckpoint.AppModuleBasic{}, + checkpointing.AppModuleBasic{}, ) // module account permissions @@ -196,6 +200,8 @@ type BabylonApp struct { BtcCheckpointKeeper btccheckpointkeeper.Keeper + CheckpointingKeeper checkpointingkeeper.Keeper + // the module manager mm *module.Manager @@ -244,6 +250,7 @@ func NewBabylonApp( epochingtypes.StoreKey, btclightclienttypes.StoreKey, btccheckpointtypes.StoreKey, + checkpointingtypes.StoreKey, ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) // NOTE: The testingkey is just mounted for testing purposes. Actual applications should @@ -342,6 +349,7 @@ func NewBabylonApp( app.EpochingKeeper = epochingkeeper.NewKeeper(appCodec, keys[epochingtypes.StoreKey], keys[epochingtypes.StoreKey], app.GetSubspace(epochingtypes.ModuleName)) app.BTCLightClientKeeper = *btclightclientkeeper.NewKeeper(appCodec, keys[btclightclienttypes.StoreKey], keys[btclightclienttypes.MemStoreKey], app.GetSubspace(btclightclienttypes.ModuleName)) app.BtcCheckpointKeeper = btccheckpointkeeper.NewKeeper(appCodec, keys[btccheckpointtypes.StoreKey], keys[btccheckpointtypes.MemStoreKey], app.GetSubspace(btccheckpointtypes.ModuleName)) + app.CheckpointingKeeper = checkpointingkeeper.NewKeeper(appCodec, keys[checkpointingtypes.StoreKey], keys[checkpointingtypes.MemStoreKey], app.GetSubspace(checkpointingtypes.ModuleName)) // create evidence keeper with router evidenceKeeper := evidencekeeper.NewKeeper( appCodec, keys[evidencetypes.StoreKey], &app.StakingKeeper, app.SlashingKeeper, @@ -384,6 +392,7 @@ func NewBabylonApp( epoching.NewAppModule(appCodec, app.EpochingKeeper, app.AccountKeeper, app.BankKeeper), btclightclient.NewAppModule(appCodec, app.BTCLightClientKeeper, app.AccountKeeper, app.BankKeeper), btccheckpoint.NewAppModule(appCodec, app.BtcCheckpointKeeper, app.AccountKeeper, app.BankKeeper), + checkpointing.NewAppModule(appCodec, app.CheckpointingKeeper, app.AccountKeeper, app.BankKeeper), ) // During begin block slashing happens after distr.BeginBlocker so that @@ -404,6 +413,7 @@ func NewBabylonApp( epochingtypes.ModuleName, btclightclienttypes.ModuleName, btccheckpointtypes.ModuleName, + checkpointingtypes.ModuleName, ) app.mm.SetOrderEndBlockers( crisistypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName, @@ -422,6 +432,7 @@ func NewBabylonApp( epochingtypes.ModuleName, btclightclienttypes.ModuleName, btccheckpointtypes.ModuleName, + checkpointingtypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -442,6 +453,7 @@ func NewBabylonApp( epochingtypes.ModuleName, btclightclienttypes.ModuleName, btccheckpointtypes.ModuleName, + checkpointingtypes.ModuleName, ) // Uncomment if you want to set a custom migration order here. @@ -479,6 +491,7 @@ func NewBabylonApp( epoching.NewAppModule(appCodec, app.EpochingKeeper, app.AccountKeeper, app.BankKeeper), btclightclient.NewAppModule(appCodec, app.BTCLightClientKeeper, app.AccountKeeper, app.BankKeeper), btccheckpoint.NewAppModule(appCodec, app.BtcCheckpointKeeper, app.AccountKeeper, app.BankKeeper), + checkpointing.NewAppModule(appCodec, app.CheckpointingKeeper, app.AccountKeeper, app.BankKeeper), ) app.sm.RegisterStoreDecoders() @@ -683,6 +696,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(epochingtypes.ModuleName) paramsKeeper.Subspace(btclightclienttypes.ModuleName) paramsKeeper.Subspace(btccheckpointtypes.ModuleName) + paramsKeeper.Subspace(checkpointingtypes.ModuleName) return paramsKeeper } diff --git a/app/app_test.go b/app/app_test.go index 90bd29564..b8eb55c8b 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -7,6 +7,7 @@ import ( "github.com/babylonchain/babylon/x/btccheckpoint" "github.com/babylonchain/babylon/x/btclightclient" + "github.com/babylonchain/babylon/x/checkpointing" "github.com/babylonchain/babylon/x/epoching" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" @@ -192,6 +193,7 @@ func TestRunMigrations(t *testing.T) { "epoching": epoching.AppModule{}.ConsensusVersion(), "btclightclient": btclightclient.AppModule{}.ConsensusVersion(), "btccheckpoint": btccheckpoint.AppModule{}.ConsensusVersion(), + "checkpointing": checkpointing.AppModule{}.ConsensusVersion(), }, ) if tc.expRunErr { @@ -251,6 +253,7 @@ func TestInitGenesisOnMigration(t *testing.T) { "epoching": epoching.AppModule{}.ConsensusVersion(), "btclightclient": btclightclient.AppModule{}.ConsensusVersion(), "btccheckpoint": btccheckpoint.AppModule{}.ConsensusVersion(), + "checkpointing": checkpointing.AppModule{}.ConsensusVersion(), }, ) require.NoError(t, err) diff --git a/x/checkpointing/keeper/keeper.go b/x/checkpointing/keeper/keeper.go index bd1ce28ca..d6e8e7677 100644 --- a/x/checkpointing/keeper/keeper.go +++ b/x/checkpointing/keeper/keeper.go @@ -1,33 +1,44 @@ package keeper import ( + "fmt" + + "github.com/tendermint/tendermint/libs/log" + "github.com/babylonchain/babylon/x/checkpointing/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) -type Keeper struct { - cdc codec.BinaryCodec - storeKey sdk.StoreKey - memKey sdk.StoreKey - paramstore paramtypes.Subspace -} +type ( + Keeper struct { + cdc codec.BinaryCodec + storeKey sdk.StoreKey + memKey sdk.StoreKey + paramstore paramtypes.Subspace + } +) func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey sdk.StoreKey, ps paramtypes.Subspace, -) *Keeper { +) Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { ps = ps.WithKeyTable(types.ParamKeyTable()) } - return &Keeper{ + + return Keeper{ cdc: cdc, storeKey: storeKey, memKey: memKey, paramstore: ps, } } + +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} diff --git a/x/checkpointing/module.go b/x/checkpointing/module.go index dea99254c..13c16bd78 100644 --- a/x/checkpointing/module.go +++ b/x/checkpointing/module.go @@ -4,6 +4,8 @@ import ( "encoding/json" "fmt" + // this line is used by starport scaffolding # 1 + "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" @@ -76,6 +78,7 @@ func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Rout // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + // this line is used by starport scaffolding # 2 } // GetTxCmd returns the capability module's root tx command. @@ -99,6 +102,7 @@ type AppModule struct { keeper keeper.Keeper accountKeeper types.AccountKeeper bankKeeper types.BankKeeper + // TODO: add dependencies to staking, slashing and evidence } func NewAppModule( From 059e1ad2393688ca2223140583505ceeb2bf5550 Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Wed, 15 Jun 2022 10:46:43 +0800 Subject: [PATCH 06/16] minor change on protos --- go.mod | 7 - proto/babylon/checkpointing/checkpoint.proto | 21 +- proto/babylon/checkpointing/query.proto | 44 +- x/btclightclient/types/query.pb.gw.go | 7 +- x/checkpointing/keeper/grpc_query_bls.go | 2 +- .../keeper/grpc_query_checkpoint.go | 4 +- x/checkpointing/types/checkpoint.pb.go | 119 ++-- x/checkpointing/types/query.pb.go | 593 ++++++++++-------- x/checkpointing/types/query.pb.gw.go | 112 ++-- x/epoching/types/query.pb.gw.go | 7 +- 10 files changed, 497 insertions(+), 419 deletions(-) diff --git a/go.mod b/go.mod index 22008ea9d..a1fca4750 100644 --- a/go.mod +++ b/go.mod @@ -22,14 +22,8 @@ require ( ) require ( - github.com/gogo/protobuf v1.3.3 - github.com/golang/protobuf v1.5.2 - github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/regen-network/cosmos-proto v0.3.1 - google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd - google.golang.org/grpc v1.46.2 google.golang.org/protobuf v1.28.0 - gopkg.in/yaml.v2 v2.4.0 ) require ( @@ -122,7 +116,6 @@ require ( golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/text v0.3.7 // indirect - google.golang.org/protobuf v1.28.0 // indirect gopkg.in/ini.v1 v1.66.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect diff --git a/proto/babylon/checkpointing/checkpoint.proto b/proto/babylon/checkpointing/checkpoint.proto index 1cdac4f76..42eebdc48 100644 --- a/proto/babylon/checkpointing/checkpoint.proto +++ b/proto/babylon/checkpointing/checkpoint.proto @@ -20,15 +20,8 @@ message RawCheckpoint { bytes bitmap = 3; // bls_multi_sig defines the multi sig that is aggregated from individual bls sigs bytes bls_multi_sig = 4; - // Status defines the status of the raw checkpoint - enum Status { - // UNCHECKPOINTED indicates the checkpoint has not appeared on BTC - UNCHECKPOINTED = 0; - // CHECKPOINTED_NOT_CONFIRMED indicates the checkpoint has been checkpointed on BTC but has insufficent confirmation - CHECKPOINTED_NOT_CONFIRMED = 1; - // CONFIRMED indicates the checkpoint has sufficient confirmation depth on BTC - CONFIRMED = 2; - } + // status defines the status of the checkpoint + RawCheckpointStatus status = 5; } // BlsSig wraps the bls sig with meta data. @@ -44,3 +37,13 @@ message BlsSig { // the signer_address defines the address of the signer string signer_address = 5; } + +// RawCheckpointStatus defines the status of the raw checkpoint +enum RawCheckpointStatus { + // UNCHECKPOINTED indicates the checkpoint has not appeared on BTC + UNCHECKPOINTED = 0; + // CHECKPOINTED_NOT_CONFIRMED indicates the checkpoint has been checkpointed on BTC but has insufficent confirmation + CHECKPOINTED_NOT_CONFIRMED = 1; + // CONFIRMED indicates the checkpoint has sufficient confirmation depth on BTC + CONFIRMED = 2; +} diff --git a/proto/babylon/checkpointing/query.proto b/proto/babylon/checkpointing/query.proto index 797466829..c178f3c8f 100644 --- a/proto/babylon/checkpointing/query.proto +++ b/proto/babylon/checkpointing/query.proto @@ -11,12 +11,12 @@ option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; // Query defines the gRPC querier service. service Query { - // RawCheckpoints queries all checkpoints that match the given status. - rpc RawCheckpoints(QueryRawCheckpointsRequest) returns (QueryRawCheckpointsResponse) { + // RawCheckpointList queries all checkpoints that match the given status. + rpc RawCheckpointList(QueryRawCheckpointListRequest) returns (QueryRawCheckpointListResponse) { option (google.api.http).get = "/babylon/checkpointing/v1/raw_checkpoints/{status}"; } - // RawCheckpoints queries a list of checkpoints starting from a given epoch number to the current epoch number. - rpc RecentRawCheckpoints(QueryRecentRawCheckpointsRequest) returns (QueryRecentRawCheckpointsResponse) { + // RawCheckpointList queries a list of checkpoints starting from a given epoch number to the current epoch number. + rpc RecentRawCheckpointList(QueryRecentRawCheckpointListRequest) returns (QueryRecentRawCheckpointListResponse) { option (google.api.http).get = "/babylon/checkpointing/v1/recent_raw_checkpoints/{from_epoch_num}"; } @@ -25,13 +25,13 @@ service Query { option (google.api.http).get = "/babylon/checkpointing/v1/raw_checkpoint/{epoch_num}"; } - // LatestCheckpoint queries the latest checkpoint. + // LatestCheckpoint queries the checkpoint with the highest epoch num. rpc LatestCheckpoint(QueryLatestCheckpointRequest) returns (QueryLatestCheckpointResponse) { option (google.api.http).get = "/babylon/checkpointing/v1/latest_checkpoint"; } - // BlsPublicKeys queries a list of bls public keys of the validators at a given epoch number. - rpc BlsPublicKeys(QueryBlsPublicKeysRequest) returns (QueryBlsPublicKeysResponse) { + // BlsPublicKeyList queries a list of bls public keys of the validators at a given epoch number. + rpc BlsPublicKeyList(QueryBlsPublicKeyListRequest) returns (QueryBlsPublicKeyListResponse) { option (google.api.http).get = "/babylon/checkpointing/v1/bls_public_keys/{epoch_num}"; } @@ -41,19 +41,19 @@ service Query { } } -// QueryRawCheckpointsRequest is the request type for the Query/RawCheckpoints +// QueryRawCheckpointListRequest is the request type for the Query/RawCheckpoints // RPC method. -message QueryRawCheckpointsRequest { +message QueryRawCheckpointListRequest { // status defines the status of the raw checkpoints of the query - string status = 1; + RawCheckpointStatus status = 1; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// QueryRawCheckpointsResponse is the response type for the Query/RawCheckpoints +// QueryRawCheckpointListResponse is the response type for the Query/RawCheckpoints // RPC method. -message QueryRawCheckpointsResponse { +message QueryRawCheckpointListResponse { // the order is going from the newest to oldest based on the epoch number repeated RawCheckpoint raw_checkpoints = 1; @@ -61,9 +61,9 @@ message QueryRawCheckpointsResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } -// QueryRecentRawCheckpointsRequest is the request type for the Query/RecentRawCheckpoints +// QueryRecentRawCheckpointListRequest is the request type for the Query/RecentRawCheckpoints // RPC method. -message QueryRecentRawCheckpointsRequest { +message QueryRecentRawCheckpointListRequest { // from_epoch defines the start epoch of the query, which is inclusive uint64 from_epoch_num = 1; @@ -71,9 +71,9 @@ message QueryRecentRawCheckpointsRequest { cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// QueryRecentRawCheckpointsResponse is the response type for the Query/RecentRawCheckpoints +// QueryRecentRawCheckpointListResponse is the response type for the Query/RecentRawCheckpoints // RPC method. -message QueryRecentRawCheckpointsResponse { +message QueryRecentRawCheckpointListResponse { // the order is going from the newest to oldest based on the epoch number repeated RawCheckpoint raw_checkpoints = 1; @@ -104,9 +104,9 @@ message QueryLatestCheckpointResponse { RawCheckpoint latest_checkpoint = 1; } -// QueryBlsPublicKeysRequest is the request type for the Query/BlsPublicKeys +// QueryBlsPublicKeyListRequest is the request type for the Query/BlsPublicKeys // RPC method. -message QueryBlsPublicKeysRequest { +message QueryBlsPublicKeyListRequest { // epoch_num defines the epoch for the queried bls public keys uint64 epoch_num = 1; @@ -114,10 +114,14 @@ message QueryBlsPublicKeysRequest { cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// QueryBlsPublicKeysResponse is the response type for the Query/BlsPublicKeys +// QueryBlsPublicKeyListResponse is the response type for the Query/BlsPublicKeys // RPC method. -message QueryBlsPublicKeysResponse { +message QueryBlsPublicKeyListResponse { repeated bytes bls_pub_keys = 1; + // the signer_address defines the address of the signer + // will change to use cosmos_proto.scalar when we use cosmos v0.46.x + // string signer_address = 5 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string signer_address = 5; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; diff --git a/x/btclightclient/types/query.pb.gw.go b/x/btclightclient/types/query.pb.gw.go index 1a67b90c8..b17c78a26 100644 --- a/x/btclightclient/types/query.pb.gw.go +++ b/x/btclightclient/types/query.pb.gw.go @@ -20,7 +20,6 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -31,7 +30,6 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage -var _ = metadata.Join func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryParamsRequest @@ -54,14 +52,12 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -69,7 +65,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/x/checkpointing/keeper/grpc_query_bls.go b/x/checkpointing/keeper/grpc_query_bls.go index 12a7aa47b..2bc015966 100644 --- a/x/checkpointing/keeper/grpc_query_bls.go +++ b/x/checkpointing/keeper/grpc_query_bls.go @@ -5,6 +5,6 @@ import ( "github.com/babylonchain/babylon/x/checkpointing/types" ) -func (k Keeper) BlsPublicKeys(c context.Context, req *types.QueryBlsPublicKeysRequest) (*types.QueryBlsPublicKeysResponse, error) { +func (k Keeper) BlsPublicKeyList(c context.Context, req *types.QueryBlsPublicKeyListRequest) (*types.QueryBlsPublicKeyListResponse, error) { panic("TODO: implement this") } diff --git a/x/checkpointing/keeper/grpc_query_checkpoint.go b/x/checkpointing/keeper/grpc_query_checkpoint.go index 018855257..a90b4e7fe 100644 --- a/x/checkpointing/keeper/grpc_query_checkpoint.go +++ b/x/checkpointing/keeper/grpc_query_checkpoint.go @@ -7,11 +7,11 @@ import ( var _ types.QueryServer = Keeper{} -func (k Keeper) RawCheckpoints(c context.Context, req *types.QueryRawCheckpointsRequest) (*types.QueryRawCheckpointsResponse, error) { +func (k Keeper) RawCheckpointList(c context.Context, req *types.QueryRawCheckpointListRequest) (*types.QueryRawCheckpointListResponse, error) { panic("TODO: implement this") } -func (k Keeper) RecentRawCheckpoints(c context.Context, req *types.QueryRecentRawCheckpointsRequest) (*types.QueryRecentRawCheckpointsResponse, error) { +func (k Keeper) RecentRawCheckpointList(c context.Context, req *types.QueryRecentRawCheckpointListRequest) (*types.QueryRecentRawCheckpointListResponse, error) { panic("TODO: implement this") } diff --git a/x/checkpointing/types/checkpoint.pb.go b/x/checkpointing/types/checkpoint.pb.go index 02efd575c..d2cafe1c9 100644 --- a/x/checkpointing/types/checkpoint.pb.go +++ b/x/checkpointing/types/checkpoint.pb.go @@ -26,36 +26,36 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// Status defines the status of the raw checkpoint -type RawCheckpoint_Status int32 +// RawCheckpointStatus defines the status of the raw checkpoint +type RawCheckpointStatus int32 const ( // UNCHECKPOINTED indicates the checkpoint has not appeared on BTC - RawCheckpoint_UNCHECKPOINTED RawCheckpoint_Status = 0 + RawCheckpointStatus_UNCHECKPOINTED RawCheckpointStatus = 0 // CHECKPOINTED_NOT_CONFIRMED indicates the checkpoint has been checkpointed on BTC but has insufficent confirmation - RawCheckpoint_CHECKPOINTED_NOT_CONFIRMED RawCheckpoint_Status = 1 + RawCheckpointStatus_CHECKPOINTED_NOT_CONFIRMED RawCheckpointStatus = 1 // CONFIRMED indicates the checkpoint has sufficient confirmation depth on BTC - RawCheckpoint_CONFIRMED RawCheckpoint_Status = 2 + RawCheckpointStatus_CONFIRMED RawCheckpointStatus = 2 ) -var RawCheckpoint_Status_name = map[int32]string{ +var RawCheckpointStatus_name = map[int32]string{ 0: "UNCHECKPOINTED", 1: "CHECKPOINTED_NOT_CONFIRMED", 2: "CONFIRMED", } -var RawCheckpoint_Status_value = map[string]int32{ +var RawCheckpointStatus_value = map[string]int32{ "UNCHECKPOINTED": 0, "CHECKPOINTED_NOT_CONFIRMED": 1, "CONFIRMED": 2, } -func (x RawCheckpoint_Status) String() string { - return proto.EnumName(RawCheckpoint_Status_name, int32(x)) +func (x RawCheckpointStatus) String() string { + return proto.EnumName(RawCheckpointStatus_name, int32(x)) } -func (RawCheckpoint_Status) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_63ff05f0a47b36f7, []int{0, 0} +func (RawCheckpointStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_63ff05f0a47b36f7, []int{0} } // RawCheckpoint wraps the multi sig with meta data. @@ -68,6 +68,8 @@ type RawCheckpoint struct { Bitmap []byte `protobuf:"bytes,3,opt,name=bitmap,proto3" json:"bitmap,omitempty"` // bls_multi_sig defines the multi sig that is aggregated from individual bls sigs BlsMultiSig []byte `protobuf:"bytes,4,opt,name=bls_multi_sig,json=blsMultiSig,proto3" json:"bls_multi_sig,omitempty"` + // status defines the status of the checkpoint + Status RawCheckpointStatus `protobuf:"varint,5,opt,name=status,proto3,enum=babylon.checkpointing.v1.RawCheckpointStatus" json:"status,omitempty"` } func (m *RawCheckpoint) Reset() { *m = RawCheckpoint{} } @@ -130,6 +132,13 @@ func (m *RawCheckpoint) GetBlsMultiSig() []byte { return nil } +func (m *RawCheckpoint) GetStatus() RawCheckpointStatus { + if m != nil { + return m.Status + } + return RawCheckpointStatus_UNCHECKPOINTED +} + // BlsSig wraps the bls sig with meta data. type BlsSig struct { // epoch_num defines the epoch number that the bls sig is signed on @@ -206,7 +215,7 @@ func (m *BlsSig) GetSignerAddress() string { } func init() { - proto.RegisterEnum("babylon.checkpointing.v1.RawCheckpoint_Status", RawCheckpoint_Status_name, RawCheckpoint_Status_value) + proto.RegisterEnum("babylon.checkpointing.v1.RawCheckpointStatus", RawCheckpointStatus_name, RawCheckpointStatus_value) proto.RegisterType((*RawCheckpoint)(nil), "babylon.checkpointing.v1.RawCheckpoint") proto.RegisterType((*BlsSig)(nil), "babylon.checkpointing.v1.BlsSig") } @@ -216,33 +225,35 @@ func init() { } var fileDescriptor_63ff05f0a47b36f7 = []byte{ - // 411 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0x3f, 0x8f, 0xd3, 0x30, - 0x18, 0xc6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xee, 0x21, - 0xf8, 0xf8, 0xcf, 0x16, 0xe9, 0x55, 0x95, 0x29, 0x6a, 0xb6, 0xaf, 0xfa, 0xf4, 0x57, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x05, 0xaa, 0xcd, 0x08, 0x6b, 0x02, 0x00, 0x00, + // 436 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0x41, 0x6b, 0xd4, 0x40, + 0x14, 0xc7, 0x33, 0xb5, 0xae, 0xdd, 0xd1, 0x5d, 0x96, 0x51, 0x34, 0xae, 0x90, 0x5d, 0x16, 0x94, + 0x45, 0x30, 0x41, 0xc5, 0x8b, 0x37, 0x9b, 0x46, 0x5a, 0xa4, 0x89, 0xa4, 0x15, 0xc4, 0xcb, 0x30, + 0x93, 0xc6, 0xc9, 0x60, 0x26, 0x13, 0x76, 0x26, 0x6a, 0x3f, 0x85, 0x1e, 0x3d, 0xf6, 0xe3, 0x78, + 0xec, 0xd1, 0xa3, 0x6c, 0x2e, 0x7e, 0x0c, 0xc9, 0x4c, 0xaa, 0xad, 0xe8, 0xcd, 0x5b, 0xfe, 0xbf, + 0xf9, 0xbf, 0x97, 0xf7, 0x7f, 0x3c, 0x78, 0x8f, 0x12, 0x7a, 0x5c, 0xca, 0x2a, 0xc8, 0x8a, 0x3c, + 0x7b, 0x57, 0x4b, 0x5e, 0x69, 0x5e, 0xb1, 0x73, 0xca, 0xaf, 0x57, 0x52, 0x4b, 0xe4, 0xf6, 0x3e, + 0xff, 0x82, 0xcf, 0x7f, 0xff, 0x70, 0x7a, 0x3b, 0x93, 0x4a, 0x48, 0x85, 0x8d, 0x2f, 0xb0, 0xc2, + 0x16, 0x4d, 0x6f, 0x30, 0xc9, 0xa4, 0xe5, 0xdd, 0x57, 0x4f, 0x67, 0x4c, 0x4a, 0x56, 0xe6, 0x81, + 0x51, 0xb4, 0x79, 0x1b, 0x68, 0x2e,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0xf8, 0x55, 0x1c, 0xee, + 0x46, 0xe1, 0x8b, 0x97, 0xc9, 0x5e, 0x7c, 0x18, 0xed, 0x4c, 0x1c, 0xe4, 0xc1, 0xe9, 0x79, 0x82, + 0xe3, 0xe4, 0x10, 0x87, 0x49, 0xfc, 0x7c, 0x2f, 0xdd, 0x8f, 0x76, 0x26, 0x00, 0x8d, 0xe0, 0xf0, + 0xb7, 0xdc, 0xd8, 0x4e, 0xbe, 0xae, 0x3d, 0x70, 0xba, 0xf6, 0xc0, 0xf7, 0xb5, 0x07, 0x3e, 0xb7, + 0x9e, 0x73, 0xda, 0x7a, 0xce, 0xb7, 0xd6, 0x73, 0xde, 0x3c, 0x61, 0x5c, 0x17, 0x0d, 0xf5, 0x33, + 0x29, 0x82, 0x7e, 0xa1, 0x59, 0x41, 0x78, 0x75, 0x26, 0x82, 0x8f, 0x7f, 0x5c, 0xa6, 0x3e, 0xae, + 0x73, 0x45, 0x07, 0xe6, 0x52, 0x1e, 0xff, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x78, 0x67, 0xa3, 0xa3, + 0xbf, 0x02, 0x00, 0x00, } func (this *RawCheckpoint) Equal(that interface{}) bool { @@ -276,6 +287,9 @@ func (this *RawCheckpoint) Equal(that interface{}) bool { if !bytes.Equal(this.BlsMultiSig, that1.BlsMultiSig) { return false } + if this.Status != that1.Status { + return false + } return true } func (m *RawCheckpoint) Marshal() (dAtA []byte, err error) { @@ -298,6 +312,11 @@ func (m *RawCheckpoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Status != 0 { + i = encodeVarintCheckpoint(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x28 + } if len(m.BlsMultiSig) > 0 { i -= len(m.BlsMultiSig) copy(dAtA[i:], m.BlsMultiSig) @@ -408,6 +427,9 @@ func (m *RawCheckpoint) Size() (n int) { if l > 0 { n += 1 + l + sovCheckpoint(uint64(l)) } + if m.Status != 0 { + n += 1 + sovCheckpoint(uint64(m.Status)) + } return n } @@ -591,6 +613,25 @@ func (m *RawCheckpoint) Unmarshal(dAtA []byte) error { m.BlsMultiSig = []byte{} } iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCheckpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= RawCheckpointStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipCheckpoint(dAtA[iNdEx:]) diff --git a/x/checkpointing/types/query.pb.go b/x/checkpointing/types/query.pb.go index 96c70c916..21479c3ed 100644 --- a/x/checkpointing/types/query.pb.go +++ b/x/checkpointing/types/query.pb.go @@ -30,27 +30,27 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// QueryRawCheckpointsRequest is the request type for the Query/RawCheckpoints +// QueryRawCheckpointListRequest is the request type for the Query/RawCheckpoints // RPC method. -type QueryRawCheckpointsRequest struct { +type QueryRawCheckpointListRequest struct { // status defines the status of the raw checkpoints of the query - Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` + Status RawCheckpointStatus `protobuf:"varint,1,opt,name=status,proto3,enum=babylon.checkpointing.v1.RawCheckpointStatus" json:"status,omitempty"` // pagination defines an optional pagination for the request. Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryRawCheckpointsRequest) Reset() { *m = QueryRawCheckpointsRequest{} } -func (m *QueryRawCheckpointsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryRawCheckpointsRequest) ProtoMessage() {} -func (*QueryRawCheckpointsRequest) Descriptor() ([]byte, []int) { +func (m *QueryRawCheckpointListRequest) Reset() { *m = QueryRawCheckpointListRequest{} } +func (m *QueryRawCheckpointListRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRawCheckpointListRequest) ProtoMessage() {} +func (*QueryRawCheckpointListRequest) Descriptor() ([]byte, []int) { return fileDescriptor_a0fdb8f0f85bb51e, []int{0} } -func (m *QueryRawCheckpointsRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryRawCheckpointListRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryRawCheckpointsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryRawCheckpointListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryRawCheckpointsRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryRawCheckpointListRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -60,53 +60,53 @@ func (m *QueryRawCheckpointsRequest) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *QueryRawCheckpointsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRawCheckpointsRequest.Merge(m, src) +func (m *QueryRawCheckpointListRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRawCheckpointListRequest.Merge(m, src) } -func (m *QueryRawCheckpointsRequest) XXX_Size() int { +func (m *QueryRawCheckpointListRequest) XXX_Size() int { return m.Size() } -func (m *QueryRawCheckpointsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRawCheckpointsRequest.DiscardUnknown(m) +func (m *QueryRawCheckpointListRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRawCheckpointListRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryRawCheckpointsRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryRawCheckpointListRequest proto.InternalMessageInfo -func (m *QueryRawCheckpointsRequest) GetStatus() string { +func (m *QueryRawCheckpointListRequest) GetStatus() RawCheckpointStatus { if m != nil { return m.Status } - return "" + return RawCheckpointStatus_UNCHECKPOINTED } -func (m *QueryRawCheckpointsRequest) GetPagination() *query.PageRequest { +func (m *QueryRawCheckpointListRequest) GetPagination() *query.PageRequest { if m != nil { return m.Pagination } return nil } -// QueryRawCheckpointsResponse is the response type for the Query/RawCheckpoints +// QueryRawCheckpointListResponse is the response type for the Query/RawCheckpoints // RPC method. -type QueryRawCheckpointsResponse struct { +type QueryRawCheckpointListResponse struct { // the order is going from the newest to oldest based on the epoch number RawCheckpoints []*RawCheckpoint `protobuf:"bytes,1,rep,name=raw_checkpoints,json=rawCheckpoints,proto3" json:"raw_checkpoints,omitempty"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryRawCheckpointsResponse) Reset() { *m = QueryRawCheckpointsResponse{} } -func (m *QueryRawCheckpointsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryRawCheckpointsResponse) ProtoMessage() {} -func (*QueryRawCheckpointsResponse) Descriptor() ([]byte, []int) { +func (m *QueryRawCheckpointListResponse) Reset() { *m = QueryRawCheckpointListResponse{} } +func (m *QueryRawCheckpointListResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRawCheckpointListResponse) ProtoMessage() {} +func (*QueryRawCheckpointListResponse) Descriptor() ([]byte, []int) { return fileDescriptor_a0fdb8f0f85bb51e, []int{1} } -func (m *QueryRawCheckpointsResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryRawCheckpointListResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryRawCheckpointsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryRawCheckpointListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryRawCheckpointsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryRawCheckpointListResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -116,53 +116,53 @@ func (m *QueryRawCheckpointsResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryRawCheckpointsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRawCheckpointsResponse.Merge(m, src) +func (m *QueryRawCheckpointListResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRawCheckpointListResponse.Merge(m, src) } -func (m *QueryRawCheckpointsResponse) XXX_Size() int { +func (m *QueryRawCheckpointListResponse) XXX_Size() int { return m.Size() } -func (m *QueryRawCheckpointsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRawCheckpointsResponse.DiscardUnknown(m) +func (m *QueryRawCheckpointListResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRawCheckpointListResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryRawCheckpointsResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryRawCheckpointListResponse proto.InternalMessageInfo -func (m *QueryRawCheckpointsResponse) GetRawCheckpoints() []*RawCheckpoint { +func (m *QueryRawCheckpointListResponse) GetRawCheckpoints() []*RawCheckpoint { if m != nil { return m.RawCheckpoints } return nil } -func (m *QueryRawCheckpointsResponse) GetPagination() *query.PageResponse { +func (m *QueryRawCheckpointListResponse) GetPagination() *query.PageResponse { if m != nil { return m.Pagination } return nil } -// QueryRecentRawCheckpointsRequest is the request type for the Query/RecentRawCheckpoints +// QueryRecentRawCheckpointListRequest is the request type for the Query/RecentRawCheckpoints // RPC method. -type QueryRecentRawCheckpointsRequest struct { +type QueryRecentRawCheckpointListRequest struct { // from_epoch defines the start epoch of the query, which is inclusive FromEpochNum uint64 `protobuf:"varint,1,opt,name=from_epoch_num,json=fromEpochNum,proto3" json:"from_epoch_num,omitempty"` // pagination defines an optional pagination for the request. Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryRecentRawCheckpointsRequest) Reset() { *m = QueryRecentRawCheckpointsRequest{} } -func (m *QueryRecentRawCheckpointsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryRecentRawCheckpointsRequest) ProtoMessage() {} -func (*QueryRecentRawCheckpointsRequest) Descriptor() ([]byte, []int) { +func (m *QueryRecentRawCheckpointListRequest) Reset() { *m = QueryRecentRawCheckpointListRequest{} } +func (m *QueryRecentRawCheckpointListRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRecentRawCheckpointListRequest) ProtoMessage() {} +func (*QueryRecentRawCheckpointListRequest) Descriptor() ([]byte, []int) { return fileDescriptor_a0fdb8f0f85bb51e, []int{2} } -func (m *QueryRecentRawCheckpointsRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryRecentRawCheckpointListRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryRecentRawCheckpointsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryRecentRawCheckpointListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryRecentRawCheckpointsRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryRecentRawCheckpointListRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -172,53 +172,53 @@ func (m *QueryRecentRawCheckpointsRequest) XXX_Marshal(b []byte, deterministic b return b[:n], nil } } -func (m *QueryRecentRawCheckpointsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRecentRawCheckpointsRequest.Merge(m, src) +func (m *QueryRecentRawCheckpointListRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRecentRawCheckpointListRequest.Merge(m, src) } -func (m *QueryRecentRawCheckpointsRequest) XXX_Size() int { +func (m *QueryRecentRawCheckpointListRequest) XXX_Size() int { return m.Size() } -func (m *QueryRecentRawCheckpointsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRecentRawCheckpointsRequest.DiscardUnknown(m) +func (m *QueryRecentRawCheckpointListRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRecentRawCheckpointListRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryRecentRawCheckpointsRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryRecentRawCheckpointListRequest proto.InternalMessageInfo -func (m *QueryRecentRawCheckpointsRequest) GetFromEpochNum() uint64 { +func (m *QueryRecentRawCheckpointListRequest) GetFromEpochNum() uint64 { if m != nil { return m.FromEpochNum } return 0 } -func (m *QueryRecentRawCheckpointsRequest) GetPagination() *query.PageRequest { +func (m *QueryRecentRawCheckpointListRequest) GetPagination() *query.PageRequest { if m != nil { return m.Pagination } return nil } -// QueryRecentRawCheckpointsResponse is the response type for the Query/RecentRawCheckpoints +// QueryRecentRawCheckpointListResponse is the response type for the Query/RecentRawCheckpoints // RPC method. -type QueryRecentRawCheckpointsResponse struct { +type QueryRecentRawCheckpointListResponse struct { // the order is going from the newest to oldest based on the epoch number RawCheckpoints []*RawCheckpoint `protobuf:"bytes,1,rep,name=raw_checkpoints,json=rawCheckpoints,proto3" json:"raw_checkpoints,omitempty"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryRecentRawCheckpointsResponse) Reset() { *m = QueryRecentRawCheckpointsResponse{} } -func (m *QueryRecentRawCheckpointsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryRecentRawCheckpointsResponse) ProtoMessage() {} -func (*QueryRecentRawCheckpointsResponse) Descriptor() ([]byte, []int) { +func (m *QueryRecentRawCheckpointListResponse) Reset() { *m = QueryRecentRawCheckpointListResponse{} } +func (m *QueryRecentRawCheckpointListResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRecentRawCheckpointListResponse) ProtoMessage() {} +func (*QueryRecentRawCheckpointListResponse) Descriptor() ([]byte, []int) { return fileDescriptor_a0fdb8f0f85bb51e, []int{3} } -func (m *QueryRecentRawCheckpointsResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryRecentRawCheckpointListResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryRecentRawCheckpointsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryRecentRawCheckpointListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryRecentRawCheckpointsResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryRecentRawCheckpointListResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -228,26 +228,26 @@ func (m *QueryRecentRawCheckpointsResponse) XXX_Marshal(b []byte, deterministic return b[:n], nil } } -func (m *QueryRecentRawCheckpointsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRecentRawCheckpointsResponse.Merge(m, src) +func (m *QueryRecentRawCheckpointListResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRecentRawCheckpointListResponse.Merge(m, src) } -func (m *QueryRecentRawCheckpointsResponse) XXX_Size() int { +func (m *QueryRecentRawCheckpointListResponse) XXX_Size() int { return m.Size() } -func (m *QueryRecentRawCheckpointsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRecentRawCheckpointsResponse.DiscardUnknown(m) +func (m *QueryRecentRawCheckpointListResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRecentRawCheckpointListResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryRecentRawCheckpointsResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryRecentRawCheckpointListResponse proto.InternalMessageInfo -func (m *QueryRecentRawCheckpointsResponse) GetRawCheckpoints() []*RawCheckpoint { +func (m *QueryRecentRawCheckpointListResponse) GetRawCheckpoints() []*RawCheckpoint { if m != nil { return m.RawCheckpoints } return nil } -func (m *QueryRecentRawCheckpointsResponse) GetPagination() *query.PageResponse { +func (m *QueryRecentRawCheckpointListResponse) GetPagination() *query.PageResponse { if m != nil { return m.Pagination } @@ -431,27 +431,27 @@ func (m *QueryLatestCheckpointResponse) GetLatestCheckpoint() *RawCheckpoint { return nil } -// QueryBlsPublicKeysRequest is the request type for the Query/BlsPublicKeys +// QueryBlsPublicKeyListRequest is the request type for the Query/BlsPublicKeys // RPC method. -type QueryBlsPublicKeysRequest struct { +type QueryBlsPublicKeyListRequest struct { // epoch_num defines the epoch for the queried bls public keys EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` // pagination defines an optional pagination for the request. Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryBlsPublicKeysRequest) Reset() { *m = QueryBlsPublicKeysRequest{} } -func (m *QueryBlsPublicKeysRequest) String() string { return proto.CompactTextString(m) } -func (*QueryBlsPublicKeysRequest) ProtoMessage() {} -func (*QueryBlsPublicKeysRequest) Descriptor() ([]byte, []int) { +func (m *QueryBlsPublicKeyListRequest) Reset() { *m = QueryBlsPublicKeyListRequest{} } +func (m *QueryBlsPublicKeyListRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBlsPublicKeyListRequest) ProtoMessage() {} +func (*QueryBlsPublicKeyListRequest) Descriptor() ([]byte, []int) { return fileDescriptor_a0fdb8f0f85bb51e, []int{8} } -func (m *QueryBlsPublicKeysRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryBlsPublicKeyListRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryBlsPublicKeysRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryBlsPublicKeyListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryBlsPublicKeysRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryBlsPublicKeyListRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -461,52 +461,56 @@ func (m *QueryBlsPublicKeysRequest) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } -func (m *QueryBlsPublicKeysRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBlsPublicKeysRequest.Merge(m, src) +func (m *QueryBlsPublicKeyListRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlsPublicKeyListRequest.Merge(m, src) } -func (m *QueryBlsPublicKeysRequest) XXX_Size() int { +func (m *QueryBlsPublicKeyListRequest) XXX_Size() int { return m.Size() } -func (m *QueryBlsPublicKeysRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBlsPublicKeysRequest.DiscardUnknown(m) +func (m *QueryBlsPublicKeyListRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlsPublicKeyListRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryBlsPublicKeysRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryBlsPublicKeyListRequest proto.InternalMessageInfo -func (m *QueryBlsPublicKeysRequest) GetEpochNum() uint64 { +func (m *QueryBlsPublicKeyListRequest) GetEpochNum() uint64 { if m != nil { return m.EpochNum } return 0 } -func (m *QueryBlsPublicKeysRequest) GetPagination() *query.PageRequest { +func (m *QueryBlsPublicKeyListRequest) GetPagination() *query.PageRequest { if m != nil { return m.Pagination } return nil } -// QueryBlsPublicKeysResponse is the response type for the Query/BlsPublicKeys +// QueryBlsPublicKeyListResponse is the response type for the Query/BlsPublicKeys // RPC method. -type QueryBlsPublicKeysResponse struct { +type QueryBlsPublicKeyListResponse struct { BlsPubKeys [][]byte `protobuf:"bytes,1,rep,name=bls_pub_keys,json=blsPubKeys,proto3" json:"bls_pub_keys,omitempty"` + // the signer_address defines the address of the signer + // will change to use cosmos_proto.scalar when we use cosmos v0.46.x + // string signer_address = 5 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + SignerAddress string `protobuf:"bytes,5,opt,name=signer_address,json=signerAddress,proto3" json:"signer_address,omitempty"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (m *QueryBlsPublicKeysResponse) Reset() { *m = QueryBlsPublicKeysResponse{} } -func (m *QueryBlsPublicKeysResponse) String() string { return proto.CompactTextString(m) } -func (*QueryBlsPublicKeysResponse) ProtoMessage() {} -func (*QueryBlsPublicKeysResponse) Descriptor() ([]byte, []int) { +func (m *QueryBlsPublicKeyListResponse) Reset() { *m = QueryBlsPublicKeyListResponse{} } +func (m *QueryBlsPublicKeyListResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBlsPublicKeyListResponse) ProtoMessage() {} +func (*QueryBlsPublicKeyListResponse) Descriptor() ([]byte, []int) { return fileDescriptor_a0fdb8f0f85bb51e, []int{9} } -func (m *QueryBlsPublicKeysResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryBlsPublicKeyListResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryBlsPublicKeysResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryBlsPublicKeyListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryBlsPublicKeysResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryBlsPublicKeyListResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -516,26 +520,33 @@ func (m *QueryBlsPublicKeysResponse) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *QueryBlsPublicKeysResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBlsPublicKeysResponse.Merge(m, src) +func (m *QueryBlsPublicKeyListResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlsPublicKeyListResponse.Merge(m, src) } -func (m *QueryBlsPublicKeysResponse) XXX_Size() int { +func (m *QueryBlsPublicKeyListResponse) XXX_Size() int { return m.Size() } -func (m *QueryBlsPublicKeysResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBlsPublicKeysResponse.DiscardUnknown(m) +func (m *QueryBlsPublicKeyListResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlsPublicKeyListResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryBlsPublicKeysResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryBlsPublicKeyListResponse proto.InternalMessageInfo -func (m *QueryBlsPublicKeysResponse) GetBlsPubKeys() [][]byte { +func (m *QueryBlsPublicKeyListResponse) GetBlsPubKeys() [][]byte { if m != nil { return m.BlsPubKeys } return nil } -func (m *QueryBlsPublicKeysResponse) GetPagination() *query.PageResponse { +func (m *QueryBlsPublicKeyListResponse) GetSignerAddress() string { + if m != nil { + return m.SignerAddress + } + return "" +} + +func (m *QueryBlsPublicKeyListResponse) GetPagination() *query.PageResponse { if m != nil { return m.Pagination } @@ -626,16 +637,16 @@ func (m *QueryParamsResponse) GetParams() Params { } func init() { - proto.RegisterType((*QueryRawCheckpointsRequest)(nil), "babylon.checkpointing.v1.QueryRawCheckpointsRequest") - proto.RegisterType((*QueryRawCheckpointsResponse)(nil), "babylon.checkpointing.v1.QueryRawCheckpointsResponse") - proto.RegisterType((*QueryRecentRawCheckpointsRequest)(nil), "babylon.checkpointing.v1.QueryRecentRawCheckpointsRequest") - proto.RegisterType((*QueryRecentRawCheckpointsResponse)(nil), "babylon.checkpointing.v1.QueryRecentRawCheckpointsResponse") + proto.RegisterType((*QueryRawCheckpointListRequest)(nil), "babylon.checkpointing.v1.QueryRawCheckpointListRequest") + proto.RegisterType((*QueryRawCheckpointListResponse)(nil), "babylon.checkpointing.v1.QueryRawCheckpointListResponse") + proto.RegisterType((*QueryRecentRawCheckpointListRequest)(nil), "babylon.checkpointing.v1.QueryRecentRawCheckpointListRequest") + proto.RegisterType((*QueryRecentRawCheckpointListResponse)(nil), "babylon.checkpointing.v1.QueryRecentRawCheckpointListResponse") proto.RegisterType((*QueryRawCheckpointRequest)(nil), "babylon.checkpointing.v1.QueryRawCheckpointRequest") proto.RegisterType((*QueryRawCheckpointResponse)(nil), "babylon.checkpointing.v1.QueryRawCheckpointResponse") proto.RegisterType((*QueryLatestCheckpointRequest)(nil), "babylon.checkpointing.v1.QueryLatestCheckpointRequest") proto.RegisterType((*QueryLatestCheckpointResponse)(nil), "babylon.checkpointing.v1.QueryLatestCheckpointResponse") - proto.RegisterType((*QueryBlsPublicKeysRequest)(nil), "babylon.checkpointing.v1.QueryBlsPublicKeysRequest") - proto.RegisterType((*QueryBlsPublicKeysResponse)(nil), "babylon.checkpointing.v1.QueryBlsPublicKeysResponse") + proto.RegisterType((*QueryBlsPublicKeyListRequest)(nil), "babylon.checkpointing.v1.QueryBlsPublicKeyListRequest") + proto.RegisterType((*QueryBlsPublicKeyListResponse)(nil), "babylon.checkpointing.v1.QueryBlsPublicKeyListResponse") proto.RegisterType((*QueryParamsRequest)(nil), "babylon.checkpointing.v1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "babylon.checkpointing.v1.QueryParamsResponse") } @@ -643,56 +654,59 @@ func init() { func init() { proto.RegisterFile("babylon/checkpointing/query.proto", fileDescriptor_a0fdb8f0f85bb51e) } var fileDescriptor_a0fdb8f0f85bb51e = []byte{ - // 776 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4f, 0x4f, 0x13, 0x4d, - 0x1c, 0xee, 0xf0, 0xf2, 0x36, 0x30, 0x40, 0x5f, 0xde, 0x91, 0x18, 0x2c, 0x58, 0xcb, 0xc6, 0x40, - 0xa3, 0xb2, 0x9b, 0x96, 0x02, 0x06, 0xff, 0x24, 0x42, 0xd4, 0x18, 0x0d, 0xd6, 0x8d, 0x5e, 0xbc, - 0x34, 0xb3, 0x9b, 0x71, 0xbb, 0x61, 0xbb, 0xb3, 0x74, 0x76, 0xc1, 0x06, 0x49, 0x8c, 0x17, 0x8f, - 0x92, 0xf8, 0x65, 0xf0, 0xe2, 0x99, 0x23, 0x89, 0x17, 0xe3, 0xc1, 0x18, 0xe0, 0x83, 0x98, 0x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0x25, 0x68, 0xa1, 0x0b, 0x91, 0x84, 0x6c, 0xca, 0x2e, 0xf6, 0x8c, 0x13, 0x1a, 0xe6, 0xb8, - 0x86, 0x59, 0x74, 0x3d, 0x59, 0x43, 0x47, 0xa6, 0x85, 0xcf, 0x61, 0x44, 0x8a, 0x82, 0xae, 0xae, - 0xc7, 0x65, 0x57, 0x57, 0xd7, 0x63, 0xd3, 0x46, 0xb9, 0xc3, 0x19, 0x2f, 0xa2, 0xf9, 0x64, 0xc6, - 0x22, 0x8d, 0x1c, 0xdb, 0xe4, 0x81, 0x24, 0xd9, 0xfe, 0x01, 0xc0, 0x74, 0xf4, 0xda, 0xd1, 0x8d, - 0x2e, 0xfb, 0x4b, 0x21, 0x93, 0x9d, 0x3d, 0x63, 0xb5, 0xa0, 0x59, 0xe0, 0x34, 0x15, 0x94, 0x4f, - 0xa6, 0x19, 0xc5, 0xcc, 0xf2, 0xd3, 0xbd, 0x83, 0x1c, 0xd8, 0x3f, 0xc8, 0x81, 0x1f, 0x07, 0x39, - 0xb0, 0x73, 0x98, 0x4b, 0xed, 0x1f, 0xe6, 0x52, 0x5f, 0x0f, 0x73, 0xa9, 0x97, 0xf3, 0x96, 0xed, - 0xd7, 0x02, 0x43, 0x35, 0x69, 0xbd, 0xd5, 0xc5, 0xac, 0x61, 0xdb, 0x3d, 0x6e, 0xf9, 0xba, 0xad, - 0xa9, 0xdf, 0xf4, 0x08, 0x33, 0xd2, 0xfc, 0x4f, 0xe0, 0xdc, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xfd, 0x0f, 0x93, 0xf8, 0xef, 0x0a, 0x00, 0x00, + // 822 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x96, 0x4f, 0x4f, 0xe3, 0x46, + 0x18, 0xc6, 0x33, 0x14, 0x22, 0x18, 0x20, 0x85, 0x29, 0x52, 0xd3, 0x94, 0xba, 0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0x5e, 0x2b, 0xe0, 0xea, 0x5a, 0x01, 0x2f, 0xae, 0x15, 0xf0, + 0x4f, 0x43, 0x49, 0x5d, 0x35, 0x94, 0xd4, 0xb3, 0x86, 0x92, 0xfa, 0x6d, 0xc5, 0x76, 0xc2, 0x6a, + 0x64, 0x6a, 0x16, 0xad, 0xb5, 0xa6, 0x58, 0x55, 0xec, 0x78, 0x37, 0x23, 0xff, 0x68, 0x1b, 0x1a, + 0xd6, 0x7d, 0xc2, 0xcc, 0x34, 0xff, 0x23, 0xba, 0xf4, 0x3a, 0x00, 0x00, 0xff, 0xff, 0x00, 0x10, + 0xb1, 0x70, 0x73, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -707,16 +721,16 @@ 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 { - // RawCheckpoints queries all checkpoints that match the given status. - RawCheckpoints(ctx context.Context, in *QueryRawCheckpointsRequest, opts ...grpc.CallOption) (*QueryRawCheckpointsResponse, error) - // RawCheckpoints queries a list of checkpoints starting from a given epoch number to the current epoch number. - RecentRawCheckpoints(ctx context.Context, in *QueryRecentRawCheckpointsRequest, opts ...grpc.CallOption) (*QueryRecentRawCheckpointsResponse, error) + // RawCheckpointList queries all checkpoints that match the given status. + RawCheckpointList(ctx context.Context, in *QueryRawCheckpointListRequest, opts ...grpc.CallOption) (*QueryRawCheckpointListResponse, error) + // RawCheckpointList queries a list of checkpoints starting from a given epoch number to the current epoch number. + RecentRawCheckpointList(ctx context.Context, in *QueryRecentRawCheckpointListRequest, opts ...grpc.CallOption) (*QueryRecentRawCheckpointListResponse, error) // RawCheckpoint queries a checkpoints at a given epoch number. RawCheckpoint(ctx context.Context, in *QueryRawCheckpointRequest, opts ...grpc.CallOption) (*QueryRawCheckpointResponse, error) - // LatestCheckpoint queries the latest checkpoint. + // LatestCheckpoint queries the checkpoint with the highest epoch num. LatestCheckpoint(ctx context.Context, in *QueryLatestCheckpointRequest, opts ...grpc.CallOption) (*QueryLatestCheckpointResponse, error) - // BlsPublicKeys queries a list of bls public keys of the validators at a given epoch number. - BlsPublicKeys(ctx context.Context, in *QueryBlsPublicKeysRequest, opts ...grpc.CallOption) (*QueryBlsPublicKeysResponse, error) + // BlsPublicKeyList queries a list of bls public keys of the validators at a given epoch number. + BlsPublicKeyList(ctx context.Context, in *QueryBlsPublicKeyListRequest, opts ...grpc.CallOption) (*QueryBlsPublicKeyListResponse, error) // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) } @@ -729,18 +743,18 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) RawCheckpoints(ctx context.Context, in *QueryRawCheckpointsRequest, opts ...grpc.CallOption) (*QueryRawCheckpointsResponse, error) { - out := new(QueryRawCheckpointsResponse) - err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/RawCheckpoints", in, out, opts...) +func (c *queryClient) RawCheckpointList(ctx context.Context, in *QueryRawCheckpointListRequest, opts ...grpc.CallOption) (*QueryRawCheckpointListResponse, error) { + out := new(QueryRawCheckpointListResponse) + err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/RawCheckpointList", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) RecentRawCheckpoints(ctx context.Context, in *QueryRecentRawCheckpointsRequest, opts ...grpc.CallOption) (*QueryRecentRawCheckpointsResponse, error) { - out := new(QueryRecentRawCheckpointsResponse) - err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/RecentRawCheckpoints", in, out, opts...) +func (c *queryClient) RecentRawCheckpointList(ctx context.Context, in *QueryRecentRawCheckpointListRequest, opts ...grpc.CallOption) (*QueryRecentRawCheckpointListResponse, error) { + out := new(QueryRecentRawCheckpointListResponse) + err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/RecentRawCheckpointList", in, out, opts...) if err != nil { return nil, err } @@ -765,9 +779,9 @@ func (c *queryClient) LatestCheckpoint(ctx context.Context, in *QueryLatestCheck return out, nil } -func (c *queryClient) BlsPublicKeys(ctx context.Context, in *QueryBlsPublicKeysRequest, opts ...grpc.CallOption) (*QueryBlsPublicKeysResponse, error) { - out := new(QueryBlsPublicKeysResponse) - err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/BlsPublicKeys", in, out, opts...) +func (c *queryClient) BlsPublicKeyList(ctx context.Context, in *QueryBlsPublicKeyListRequest, opts ...grpc.CallOption) (*QueryBlsPublicKeyListResponse, error) { + out := new(QueryBlsPublicKeyListResponse) + err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/BlsPublicKeyList", in, out, opts...) if err != nil { return nil, err } @@ -785,16 +799,16 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . // QueryServer is the server API for Query service. type QueryServer interface { - // RawCheckpoints queries all checkpoints that match the given status. - RawCheckpoints(context.Context, *QueryRawCheckpointsRequest) (*QueryRawCheckpointsResponse, error) - // RawCheckpoints queries a list of checkpoints starting from a given epoch number to the current epoch number. - RecentRawCheckpoints(context.Context, *QueryRecentRawCheckpointsRequest) (*QueryRecentRawCheckpointsResponse, error) + // RawCheckpointList queries all checkpoints that match the given status. + RawCheckpointList(context.Context, *QueryRawCheckpointListRequest) (*QueryRawCheckpointListResponse, error) + // RawCheckpointList queries a list of checkpoints starting from a given epoch number to the current epoch number. + RecentRawCheckpointList(context.Context, *QueryRecentRawCheckpointListRequest) (*QueryRecentRawCheckpointListResponse, error) // RawCheckpoint queries a checkpoints at a given epoch number. RawCheckpoint(context.Context, *QueryRawCheckpointRequest) (*QueryRawCheckpointResponse, error) - // LatestCheckpoint queries the latest checkpoint. + // LatestCheckpoint queries the checkpoint with the highest epoch num. LatestCheckpoint(context.Context, *QueryLatestCheckpointRequest) (*QueryLatestCheckpointResponse, error) - // BlsPublicKeys queries a list of bls public keys of the validators at a given epoch number. - BlsPublicKeys(context.Context, *QueryBlsPublicKeysRequest) (*QueryBlsPublicKeysResponse, error) + // BlsPublicKeyList queries a list of bls public keys of the validators at a given epoch number. + BlsPublicKeyList(context.Context, *QueryBlsPublicKeyListRequest) (*QueryBlsPublicKeyListResponse, error) // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) } @@ -803,11 +817,11 @@ type QueryServer interface { type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) RawCheckpoints(ctx context.Context, req *QueryRawCheckpointsRequest) (*QueryRawCheckpointsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RawCheckpoints not implemented") +func (*UnimplementedQueryServer) RawCheckpointList(ctx context.Context, req *QueryRawCheckpointListRequest) (*QueryRawCheckpointListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RawCheckpointList not implemented") } -func (*UnimplementedQueryServer) RecentRawCheckpoints(ctx context.Context, req *QueryRecentRawCheckpointsRequest) (*QueryRecentRawCheckpointsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RecentRawCheckpoints not implemented") +func (*UnimplementedQueryServer) RecentRawCheckpointList(ctx context.Context, req *QueryRecentRawCheckpointListRequest) (*QueryRecentRawCheckpointListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RecentRawCheckpointList not implemented") } func (*UnimplementedQueryServer) RawCheckpoint(ctx context.Context, req *QueryRawCheckpointRequest) (*QueryRawCheckpointResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RawCheckpoint not implemented") @@ -815,8 +829,8 @@ func (*UnimplementedQueryServer) RawCheckpoint(ctx context.Context, req *QueryRa func (*UnimplementedQueryServer) LatestCheckpoint(ctx context.Context, req *QueryLatestCheckpointRequest) (*QueryLatestCheckpointResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method LatestCheckpoint not implemented") } -func (*UnimplementedQueryServer) BlsPublicKeys(ctx context.Context, req *QueryBlsPublicKeysRequest) (*QueryBlsPublicKeysResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method BlsPublicKeys not implemented") +func (*UnimplementedQueryServer) BlsPublicKeyList(ctx context.Context, req *QueryBlsPublicKeyListRequest) (*QueryBlsPublicKeyListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BlsPublicKeyList not implemented") } func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") @@ -826,38 +840,38 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_RawCheckpoints_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRawCheckpointsRequest) +func _Query_RawCheckpointList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRawCheckpointListRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).RawCheckpoints(ctx, in) + return srv.(QueryServer).RawCheckpointList(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/babylon.checkpointing.v1.Query/RawCheckpoints", + FullMethod: "/babylon.checkpointing.v1.Query/RawCheckpointList", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).RawCheckpoints(ctx, req.(*QueryRawCheckpointsRequest)) + return srv.(QueryServer).RawCheckpointList(ctx, req.(*QueryRawCheckpointListRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_RecentRawCheckpoints_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRecentRawCheckpointsRequest) +func _Query_RecentRawCheckpointList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRecentRawCheckpointListRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).RecentRawCheckpoints(ctx, in) + return srv.(QueryServer).RecentRawCheckpointList(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/babylon.checkpointing.v1.Query/RecentRawCheckpoints", + FullMethod: "/babylon.checkpointing.v1.Query/RecentRawCheckpointList", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).RecentRawCheckpoints(ctx, req.(*QueryRecentRawCheckpointsRequest)) + return srv.(QueryServer).RecentRawCheckpointList(ctx, req.(*QueryRecentRawCheckpointListRequest)) } return interceptor(ctx, in, info, handler) } @@ -898,20 +912,20 @@ func _Query_LatestCheckpoint_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } -func _Query_BlsPublicKeys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryBlsPublicKeysRequest) +func _Query_BlsPublicKeyList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBlsPublicKeyListRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).BlsPublicKeys(ctx, in) + return srv.(QueryServer).BlsPublicKeyList(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/babylon.checkpointing.v1.Query/BlsPublicKeys", + FullMethod: "/babylon.checkpointing.v1.Query/BlsPublicKeyList", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).BlsPublicKeys(ctx, req.(*QueryBlsPublicKeysRequest)) + return srv.(QueryServer).BlsPublicKeyList(ctx, req.(*QueryBlsPublicKeyListRequest)) } return interceptor(ctx, in, info, handler) } @@ -939,12 +953,12 @@ var _Query_serviceDesc = grpc.ServiceDesc{ HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "RawCheckpoints", - Handler: _Query_RawCheckpoints_Handler, + MethodName: "RawCheckpointList", + Handler: _Query_RawCheckpointList_Handler, }, { - MethodName: "RecentRawCheckpoints", - Handler: _Query_RecentRawCheckpoints_Handler, + MethodName: "RecentRawCheckpointList", + Handler: _Query_RecentRawCheckpointList_Handler, }, { MethodName: "RawCheckpoint", @@ -955,8 +969,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_LatestCheckpoint_Handler, }, { - MethodName: "BlsPublicKeys", - Handler: _Query_BlsPublicKeys_Handler, + MethodName: "BlsPublicKeyList", + Handler: _Query_BlsPublicKeyList_Handler, }, { MethodName: "Params", @@ -967,7 +981,7 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Metadata: "babylon/checkpointing/query.proto", } -func (m *QueryRawCheckpointsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryRawCheckpointListRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -977,12 +991,12 @@ func (m *QueryRawCheckpointsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryRawCheckpointsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryRawCheckpointListRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryRawCheckpointsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryRawCheckpointListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -999,17 +1013,15 @@ func (m *QueryRawCheckpointsRequest) MarshalToSizedBuffer(dAtA []byte) (int, err i-- dAtA[i] = 0x12 } - if len(m.Status) > 0 { - i -= len(m.Status) - copy(dAtA[i:], m.Status) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Status))) + if m.Status != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Status)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *QueryRawCheckpointsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryRawCheckpointListResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1019,12 +1031,12 @@ func (m *QueryRawCheckpointsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryRawCheckpointsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryRawCheckpointListResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryRawCheckpointsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryRawCheckpointListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1058,7 +1070,7 @@ func (m *QueryRawCheckpointsResponse) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } -func (m *QueryRecentRawCheckpointsRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryRecentRawCheckpointListRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1068,12 +1080,12 @@ func (m *QueryRecentRawCheckpointsRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryRecentRawCheckpointsRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryRecentRawCheckpointListRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryRecentRawCheckpointsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryRecentRawCheckpointListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1098,7 +1110,7 @@ func (m *QueryRecentRawCheckpointsRequest) MarshalToSizedBuffer(dAtA []byte) (in return len(dAtA) - i, nil } -func (m *QueryRecentRawCheckpointsResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryRecentRawCheckpointListResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1108,12 +1120,12 @@ func (m *QueryRecentRawCheckpointsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryRecentRawCheckpointsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryRecentRawCheckpointListResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryRecentRawCheckpointsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryRecentRawCheckpointListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1268,7 +1280,7 @@ func (m *QueryLatestCheckpointResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *QueryBlsPublicKeysRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryBlsPublicKeyListRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1278,12 +1290,12 @@ func (m *QueryBlsPublicKeysRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryBlsPublicKeysRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryBlsPublicKeyListRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryBlsPublicKeysRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryBlsPublicKeyListRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1308,7 +1320,7 @@ func (m *QueryBlsPublicKeysRequest) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *QueryBlsPublicKeysResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryBlsPublicKeyListResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1318,16 +1330,23 @@ func (m *QueryBlsPublicKeysResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryBlsPublicKeysResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryBlsPublicKeyListResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryBlsPublicKeysResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryBlsPublicKeyListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if len(m.SignerAddress) > 0 { + i -= len(m.SignerAddress) + copy(dAtA[i:], m.SignerAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.SignerAddress))) + i-- + dAtA[i] = 0x2a + } if m.Pagination != nil { { size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) @@ -1419,15 +1438,14 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *QueryRawCheckpointsRequest) Size() (n int) { +func (m *QueryRawCheckpointListRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Status) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if m.Status != 0 { + n += 1 + sovQuery(uint64(m.Status)) } if m.Pagination != nil { l = m.Pagination.Size() @@ -1436,7 +1454,7 @@ func (m *QueryRawCheckpointsRequest) Size() (n int) { return n } -func (m *QueryRawCheckpointsResponse) Size() (n int) { +func (m *QueryRawCheckpointListResponse) Size() (n int) { if m == nil { return 0 } @@ -1455,7 +1473,7 @@ func (m *QueryRawCheckpointsResponse) Size() (n int) { return n } -func (m *QueryRecentRawCheckpointsRequest) Size() (n int) { +func (m *QueryRecentRawCheckpointListRequest) Size() (n int) { if m == nil { return 0 } @@ -1471,7 +1489,7 @@ func (m *QueryRecentRawCheckpointsRequest) Size() (n int) { return n } -func (m *QueryRecentRawCheckpointsResponse) Size() (n int) { +func (m *QueryRecentRawCheckpointListResponse) Size() (n int) { if m == nil { return 0 } @@ -1537,7 +1555,7 @@ func (m *QueryLatestCheckpointResponse) Size() (n int) { return n } -func (m *QueryBlsPublicKeysRequest) Size() (n int) { +func (m *QueryBlsPublicKeyListRequest) Size() (n int) { if m == nil { return 0 } @@ -1553,7 +1571,7 @@ func (m *QueryBlsPublicKeysRequest) Size() (n int) { return n } -func (m *QueryBlsPublicKeysResponse) Size() (n int) { +func (m *QueryBlsPublicKeyListResponse) Size() (n int) { if m == nil { return 0 } @@ -1569,6 +1587,10 @@ func (m *QueryBlsPublicKeysResponse) Size() (n int) { l = m.Pagination.Size() n += 1 + l + sovQuery(uint64(l)) } + l = len(m.SignerAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -1598,7 +1620,7 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QueryRawCheckpointsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryRawCheckpointListRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1621,17 +1643,17 @@ func (m *QueryRawCheckpointsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryRawCheckpointsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRawCheckpointListRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRawCheckpointsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRawCheckpointListRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } - var stringLen uint64 + m.Status = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1641,24 +1663,11 @@ func (m *QueryRawCheckpointsRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.Status |= RawCheckpointStatus(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Status = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) @@ -1716,7 +1725,7 @@ func (m *QueryRawCheckpointsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryRawCheckpointsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryRawCheckpointListResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1739,10 +1748,10 @@ func (m *QueryRawCheckpointsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryRawCheckpointsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRawCheckpointListResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRawCheckpointsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRawCheckpointListResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1836,7 +1845,7 @@ func (m *QueryRawCheckpointsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryRecentRawCheckpointsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryRecentRawCheckpointListRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1859,10 +1868,10 @@ func (m *QueryRecentRawCheckpointsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryRecentRawCheckpointsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRecentRawCheckpointListRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRecentRawCheckpointsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRecentRawCheckpointListRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1941,7 +1950,7 @@ func (m *QueryRecentRawCheckpointsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryRecentRawCheckpointsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryRecentRawCheckpointListResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1964,10 +1973,10 @@ func (m *QueryRecentRawCheckpointsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryRecentRawCheckpointsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryRecentRawCheckpointListResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRecentRawCheckpointsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryRecentRawCheckpointListResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2352,7 +2361,7 @@ func (m *QueryLatestCheckpointResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryBlsPublicKeysRequest) Unmarshal(dAtA []byte) error { +func (m *QueryBlsPublicKeyListRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2375,10 +2384,10 @@ func (m *QueryBlsPublicKeysRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryBlsPublicKeysRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBlsPublicKeyListRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBlsPublicKeysRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryBlsPublicKeyListRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2457,7 +2466,7 @@ func (m *QueryBlsPublicKeysRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryBlsPublicKeysResponse) Unmarshal(dAtA []byte) error { +func (m *QueryBlsPublicKeyListResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2480,10 +2489,10 @@ func (m *QueryBlsPublicKeysResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryBlsPublicKeysResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBlsPublicKeyListResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBlsPublicKeysResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryBlsPublicKeyListResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2554,6 +2563,38 @@ func (m *QueryBlsPublicKeysResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SignerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SignerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/checkpointing/types/query.pb.gw.go b/x/checkpointing/types/query.pb.gw.go index f51c438ba..98420a2c2 100644 --- a/x/checkpointing/types/query.pb.gw.go +++ b/x/checkpointing/types/query.pb.gw.go @@ -32,15 +32,16 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var ( - filter_Query_RawCheckpoints_0 = &utilities.DoubleArray{Encoding: map[string]int{"status": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + filter_Query_RawCheckpointList_0 = &utilities.DoubleArray{Encoding: map[string]int{"status": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) -func request_Query_RawCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRawCheckpointsRequest +func request_Query_RawCheckpointList_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRawCheckpointListRequest var metadata runtime.ServerMetadata var ( val string + e int32 ok bool err error _ = err @@ -51,30 +52,33 @@ func request_Query_RawCheckpoints_0(ctx context.Context, marshaler runtime.Marsh return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status") } - protoReq.Status, err = runtime.String(val) + e, err = runtime.Enum(val, RawCheckpointStatus_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status", err) } + protoReq.Status = RawCheckpointStatus(e) + if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RawCheckpoints_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RawCheckpointList_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.RawCheckpoints(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.RawCheckpointList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_RawCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRawCheckpointsRequest +func local_request_Query_RawCheckpointList_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRawCheckpointListRequest var metadata runtime.ServerMetadata var ( val string + e int32 ok bool err error _ = err @@ -85,30 +89,32 @@ func local_request_Query_RawCheckpoints_0(ctx context.Context, marshaler runtime return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status") } - protoReq.Status, err = runtime.String(val) + e, err = runtime.Enum(val, RawCheckpointStatus_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status", err) } + protoReq.Status = RawCheckpointStatus(e) + if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RawCheckpoints_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RawCheckpointList_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.RawCheckpoints(ctx, &protoReq) + msg, err := server.RawCheckpointList(ctx, &protoReq) return msg, metadata, err } var ( - filter_Query_RecentRawCheckpoints_0 = &utilities.DoubleArray{Encoding: map[string]int{"from_epoch_num": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + filter_Query_RecentRawCheckpointList_0 = &utilities.DoubleArray{Encoding: map[string]int{"from_epoch_num": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) -func request_Query_RecentRawCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRecentRawCheckpointsRequest +func request_Query_RecentRawCheckpointList_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRecentRawCheckpointListRequest var metadata runtime.ServerMetadata var ( @@ -132,17 +138,17 @@ func request_Query_RecentRawCheckpoints_0(ctx context.Context, marshaler runtime if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RecentRawCheckpoints_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RecentRawCheckpointList_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.RecentRawCheckpoints(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.RecentRawCheckpointList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_RecentRawCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRecentRawCheckpointsRequest +func local_request_Query_RecentRawCheckpointList_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRecentRawCheckpointListRequest var metadata runtime.ServerMetadata var ( @@ -166,11 +172,11 @@ func local_request_Query_RecentRawCheckpoints_0(ctx context.Context, marshaler r if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RecentRawCheckpoints_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RecentRawCheckpointList_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.RecentRawCheckpoints(ctx, &protoReq) + msg, err := server.RecentRawCheckpointList(ctx, &protoReq) return msg, metadata, err } @@ -248,11 +254,11 @@ func local_request_Query_LatestCheckpoint_0(ctx context.Context, marshaler runti } var ( - filter_Query_BlsPublicKeys_0 = &utilities.DoubleArray{Encoding: map[string]int{"epoch_num": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + filter_Query_BlsPublicKeyList_0 = &utilities.DoubleArray{Encoding: map[string]int{"epoch_num": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) -func request_Query_BlsPublicKeys_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryBlsPublicKeysRequest +func request_Query_BlsPublicKeyList_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBlsPublicKeyListRequest var metadata runtime.ServerMetadata var ( @@ -276,17 +282,17 @@ func request_Query_BlsPublicKeys_0(ctx context.Context, marshaler runtime.Marsha if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BlsPublicKeys_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BlsPublicKeyList_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.BlsPublicKeys(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.BlsPublicKeyList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_BlsPublicKeys_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryBlsPublicKeysRequest +func local_request_Query_BlsPublicKeyList_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBlsPublicKeyListRequest var metadata runtime.ServerMetadata var ( @@ -310,11 +316,11 @@ func local_request_Query_BlsPublicKeys_0(ctx context.Context, marshaler runtime. if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BlsPublicKeys_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BlsPublicKeyList_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.BlsPublicKeys(ctx, &protoReq) + msg, err := server.BlsPublicKeyList(ctx, &protoReq) return msg, metadata, err } @@ -343,7 +349,7 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal // Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_RawCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RawCheckpointList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -352,18 +358,18 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_RawCheckpoints_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_RawCheckpointList_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_RawCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RawCheckpointList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_RecentRawCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RecentRawCheckpointList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -372,14 +378,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_RecentRawCheckpoints_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_RecentRawCheckpointList_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_RecentRawCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RecentRawCheckpointList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -423,7 +429,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_BlsPublicKeys_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_BlsPublicKeyList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -432,14 +438,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_BlsPublicKeys_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_BlsPublicKeyList_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_BlsPublicKeys_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_BlsPublicKeyList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -504,7 +510,7 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_RawCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RawCheckpointList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -513,18 +519,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_RawCheckpoints_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_RawCheckpointList_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_RawCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RawCheckpointList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_RecentRawCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RecentRawCheckpointList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -533,14 +539,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_RecentRawCheckpoints_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_RecentRawCheckpointList_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_RecentRawCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RecentRawCheckpointList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -584,7 +590,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_BlsPublicKeys_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_BlsPublicKeyList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -593,14 +599,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_BlsPublicKeys_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_BlsPublicKeyList_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_BlsPublicKeys_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_BlsPublicKeyList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -628,29 +634,29 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_RawCheckpoints_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "checkpointing", "v1", "raw_checkpoints", "status"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_RawCheckpointList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "checkpointing", "v1", "raw_checkpoints", "status"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_RecentRawCheckpoints_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "checkpointing", "v1", "recent_raw_checkpoints", "from_epoch_num"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_RecentRawCheckpointList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "checkpointing", "v1", "recent_raw_checkpoints", "from_epoch_num"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_RawCheckpoint_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "checkpointing", "v1", "raw_checkpoint", "epoch_num"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_LatestCheckpoint_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "checkpointing", "v1", "latest_checkpoint"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_BlsPublicKeys_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "checkpointing", "v1", "bls_public_keys", "epoch_num"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_BlsPublicKeyList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "checkpointing", "v1", "bls_public_keys", "epoch_num"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "checkpointing", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( - forward_Query_RawCheckpoints_0 = runtime.ForwardResponseMessage + forward_Query_RawCheckpointList_0 = runtime.ForwardResponseMessage - forward_Query_RecentRawCheckpoints_0 = runtime.ForwardResponseMessage + forward_Query_RecentRawCheckpointList_0 = runtime.ForwardResponseMessage forward_Query_RawCheckpoint_0 = runtime.ForwardResponseMessage forward_Query_LatestCheckpoint_0 = runtime.ForwardResponseMessage - forward_Query_BlsPublicKeys_0 = runtime.ForwardResponseMessage + forward_Query_BlsPublicKeyList_0 = runtime.ForwardResponseMessage forward_Query_Params_0 = runtime.ForwardResponseMessage ) diff --git a/x/epoching/types/query.pb.gw.go b/x/epoching/types/query.pb.gw.go index 4c51f3300..f88cbb3fe 100644 --- a/x/epoching/types/query.pb.gw.go +++ b/x/epoching/types/query.pb.gw.go @@ -20,7 +20,6 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -31,7 +30,6 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage -var _ = metadata.Join func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryParamsRequest @@ -54,14 +52,12 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -69,7 +65,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) From aa3237864afe6636609e18e488d7f519e96045b7 Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Thu, 16 Jun 2022 18:11:10 +0800 Subject: [PATCH 07/16] add blssig set --- proto/babylon/checkpointing/checkpoint.proto | 1 - x/checkpointing/types/blssig_set.go | 44 ++++++++++++++ x/checkpointing/types/checkpoint.pb.go | 62 ++++++++++---------- 3 files changed, 75 insertions(+), 32 deletions(-) create mode 100644 x/checkpointing/types/blssig_set.go diff --git a/proto/babylon/checkpointing/checkpoint.proto b/proto/babylon/checkpointing/checkpoint.proto index 42eebdc48..8109e200a 100644 --- a/proto/babylon/checkpointing/checkpoint.proto +++ b/proto/babylon/checkpointing/checkpoint.proto @@ -10,7 +10,6 @@ option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; // RawCheckpoint wraps the multi sig with meta data. message RawCheckpoint { option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; // epoch_num defines the epoch number the raw checkpoint is for uint64 epoch_num = 1; diff --git a/x/checkpointing/types/blssig_set.go b/x/checkpointing/types/blssig_set.go new file mode 100644 index 000000000..beee31b04 --- /dev/null +++ b/x/checkpointing/types/blssig_set.go @@ -0,0 +1,44 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/tendermint/tendermint/libs/bits" + "github.com/tendermint/tendermint/libs/bytes" +) + +type BlsSigSet struct { + epoch uint16 + lastCommitHash bytes.HexBytes + validators types.Validators + + sum uint64 + sigsBySigner map[string]*BlsSig + sigsBitArray *bits.BitArray +} + +// NewBlsSigSet constructs a new BlsSigSet struct used to accumulate bls sigs for a given epoch +func NewBlsSigSet(epoch uint16, lastCommitHash bytes.HexBytes, validators types.Validators) *BlsSigSet { + return &BlsSigSet{ + epoch: epoch, + lastCommitHash: lastCommitHash, + validators: validators, + sum: 0, + sigsBySigner: make(map[string]*BlsSig, validators.Len()), + sigsBitArray: bits.NewBitArray(validators.Len()), + } +} + +func (bs *BlsSigSet) AddBlsSig(sig *BlsSig) (bool, error) { + if bs == nil { + panic("AddVote() on nil BlsSigSet") + } + return bs.addBlsSig(sig) +} + +func (bs *BlsSigSet) addBlsSig(sig *BlsSig) (bool, error) { + panic("implement this!") +} + +func (bs *BlsSigSet) MakeRawCheckpoint() *RawCheckpoint { + panic("implement this!") +} diff --git a/x/checkpointing/types/checkpoint.pb.go b/x/checkpointing/types/checkpoint.pb.go index d2cafe1c9..9c2a275be 100644 --- a/x/checkpointing/types/checkpoint.pb.go +++ b/x/checkpointing/types/checkpoint.pb.go @@ -72,8 +72,9 @@ type RawCheckpoint struct { Status RawCheckpointStatus `protobuf:"varint,5,opt,name=status,proto3,enum=babylon.checkpointing.v1.RawCheckpointStatus" json:"status,omitempty"` } -func (m *RawCheckpoint) Reset() { *m = RawCheckpoint{} } -func (*RawCheckpoint) ProtoMessage() {} +func (m *RawCheckpoint) Reset() { *m = RawCheckpoint{} } +func (m *RawCheckpoint) String() string { return proto.CompactTextString(m) } +func (*RawCheckpoint) ProtoMessage() {} func (*RawCheckpoint) Descriptor() ([]byte, []int) { return fileDescriptor_63ff05f0a47b36f7, []int{0} } @@ -225,35 +226,34 @@ func init() { } var fileDescriptor_63ff05f0a47b36f7 = []byte{ - // 436 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0x41, 0x6b, 0xd4, 0x40, - 0x14, 0xc7, 0x33, 0xb5, 0xae, 0xdd, 0xd1, 0x5d, 0x96, 0x51, 0x34, 0xae, 0x90, 0x5d, 0x16, 0x94, - 0x45, 0x30, 0x41, 0xc5, 0x8b, 0x37, 0x9b, 0x46, 0x5a, 0xa4, 0x89, 0xa4, 0x15, 0xc4, 0xcb, 0x30, - 0x93, 0xc6, 0xc9, 0x60, 0x26, 0x13, 0x76, 0x26, 0x6a, 0x3f, 0x85, 0x1e, 0x3d, 0xf6, 0xe3, 0x78, - 0xec, 0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0x78, 0x67, 0xa3, 0xa3, - 0xbf, 0x02, 0x00, 0x00, + // 432 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0x41, 0x8b, 0xd4, 0x30, + 0x14, 0xc7, 0x27, 0xeb, 0x38, 0x3a, 0xd1, 0x29, 0x43, 0x14, 0xad, 0x23, 0x74, 0x87, 0x01, 0xa5, + 0x08, 0xb6, 0xa8, 0x78, 0xf1, 0xe6, 0x76, 0x2b, 0xbb, 0xc8, 0xb6, 0xd2, 0x5d, 0x41, 0xbc, 0x84, + 0xa4, 0x5b, 0xd3, 0x60, 0xd3, 0x94, 0x49, 0xaa, 0xee, 0xa7, 0xd0, 0x8f, 0xe0, 0xc7, 0xf1, 0xb8, + 0x47, 0x6f, 0xca, 0xcc, 0xc5, 0x8f, 0x21, 0x4d, 0xba, 0xba, 0x23, 0x7a, 0xf3, 0xd6, 0xff, 0x2f, + 0xff, 0xf7, 0xfa, 0x7f, 0x8f, 0x07, 0xef, 0x52, 0x42, 0x4f, 0x2a, 0x59, 0x87, 0x79, 0x59, 0xe4, + 0x6f, 0x1b, 0xc9, 0x6b, 0xcd, 0x6b, 0x76, 0x4e, 0x05, 0xcd, 0x52, 0x6a, 0x89, 0xdc, 0xde, 0x17, + 0x6c, 0xf8, 0x82, 0x77, 0x0f, 0x66, 0xb7, 0x72, 0xa9, 0x84, 0x54, 0xd8, 0xf8, 0x42, 0x2b, 0x6c, + 0xd1, 0xec, 0x3a, 0x93, 0x4c, 0x5a, 0xde, 0x7d, 0xf5, 0x74, 0x9b, 0x49, 0xc9, 0xaa, 0x22, 0x34, + 0x8a, 0xb6, 0x6f, 0x42, 0xcd, 0x45, 0xa1, 0x34, 0x11, 0x8d, 0x35, 0x2c, 0xbe, 0x01, 0x38, 0xc9, + 0xc8, 0xfb, 0xe8, 0xd7, 0x9f, 0xd0, 0x6d, 0x38, 0x2e, 0x1a, 0x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, 0xfb, 0xd9, 0x41, 0xbc, 0x3b, 0x05, 0x68, 0x02, 0xc7, 0xbf, 0xe5, 0xd6, 0x4e, 0xfa, + 0x65, 0xe5, 0x81, 0xd3, 0x95, 0x07, 0xbe, 0xaf, 0x3c, 0xf0, 0x69, 0xed, 0x0d, 0x4e, 0xd7, 0xde, + 0xe0, 0xeb, 0xda, 0x1b, 0xbc, 0x7e, 0xcc, 0xb8, 0x2e, 0x5b, 0x1a, 0xe4, 0x52, 0x84, 0xfd, 0x32, + 0xf3, 0x92, 0xf0, 0xfa, 0x4c, 0x84, 0x1f, 0xfe, 0xb8, 0x4a, 0x7d, 0xd2, 0x14, 0x8a, 0x8e, 0xcc, + 0x95, 0x3c, 0xfa, 0x19, 0x00, 0x00, 0xff, 0xff, 0x04, 0x11, 0x89, 0xc1, 0xbb, 0x02, 0x00, 0x00, } func (this *RawCheckpoint) Equal(that interface{}) bool { From 6d5a391154f783f37bcc482c54a37fa10de1e028 Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Tue, 21 Jun 2022 17:48:24 +0800 Subject: [PATCH 08/16] added bls sig state --- .gitignore | 1 + proto/babylon/checkpointing/query.proto | 12 +-- x/checkpointing/keeper/keeper.go | 33 +++++-- x/checkpointing/keeper/state.go | 104 ++++++++++++++++++++++ x/checkpointing/types/errors.go | 7 +- x/checkpointing/types/expected_keepers.go | 10 +++ x/checkpointing/types/keys.go | 25 ++++++ x/checkpointing/types/types.go | 3 + x/checkpointing/types/utils.go | 13 +++ 9 files changed, 194 insertions(+), 14 deletions(-) create mode 100644 x/checkpointing/keeper/state.go create mode 100644 x/checkpointing/types/types.go create mode 100644 x/checkpointing/types/utils.go diff --git a/.gitignore b/.gitignore index 761d2b628..301a95c1b 100644 --- a/.gitignore +++ b/.gitignore @@ -207,3 +207,4 @@ $RECYCLE.BIN/ /x/incentives/keeper/babylon_testing/ tools-stamp /tests/localbabylon/.babylond/* +docs/diagrams/plantuml.jar diff --git a/proto/babylon/checkpointing/query.proto b/proto/babylon/checkpointing/query.proto index c178f3c8f..f2b2b794c 100644 --- a/proto/babylon/checkpointing/query.proto +++ b/proto/babylon/checkpointing/query.proto @@ -117,11 +117,7 @@ message QueryBlsPublicKeyListRequest { // QueryBlsPublicKeyListResponse is the response type for the Query/BlsPublicKeys // RPC method. message QueryBlsPublicKeyListResponse { - repeated bytes bls_pub_keys = 1; - // the signer_address defines the address of the signer - // will change to use cosmos_proto.scalar when we use cosmos v0.46.x - // string signer_address = 5 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string signer_address = 5; + repeated ValidatorWithBlsKey validator_with_bls_keys = 1; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -135,3 +131,9 @@ message QueryParamsResponse { // params holds all the parameters of this module. Params params = 1 [ (gogoproto.nullable) = false ]; } + +// ValidatorWithBlsKey couples validator address and its bls public key +message ValidatorWithBlsKey { + string validator_address = 1; + bytes bls_pub_key = 2; +} diff --git a/x/checkpointing/keeper/keeper.go b/x/checkpointing/keeper/keeper.go index d6e8e7677..b438b66a4 100644 --- a/x/checkpointing/keeper/keeper.go +++ b/x/checkpointing/keeper/keeper.go @@ -13,10 +13,12 @@ import ( type ( Keeper struct { - cdc codec.BinaryCodec - storeKey sdk.StoreKey - memKey sdk.StoreKey - paramstore paramtypes.Subspace + cdc codec.BinaryCodec + storeKey sdk.StoreKey + memKey sdk.StoreKey + stakingKeeper types.StakingKeeper + epochingKeeper types.EpochingKeeper + paramstore paramtypes.Subspace } ) @@ -24,6 +26,8 @@ func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey sdk.StoreKey, + stakingKeeper types.StakingKeeper, + epochingKeeper types.EpochingKeeper, ps paramtypes.Subspace, ) Keeper { // set KeyTable if it has not already been set @@ -32,13 +36,26 @@ func NewKeeper( } return Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, + cdc: cdc, + storeKey: storeKey, + memKey: memKey, + stakingKeeper: stakingKeeper, + epochingKeeper: epochingKeeper, + paramstore: ps, } } func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } + +func (k Keeper) AddBlsSig(ctx sdk.Context, sig *types.BlsSig) error { + // TODO: some checks: 1. duplication check 2. epoch check 3. raw ckpt existence check + // TODO: aggregate bls sigs and try to build raw checkpoints + k.BlsSigsState(ctx).InsertBlsSig(sig) + return nil +} + +func (k Keeper) AddCheckpoint(ctx sdk.Context, epoch uint64, ckpt *types.RawCheckpoint) error { + panic("implement this") +} diff --git a/x/checkpointing/keeper/state.go b/x/checkpointing/keeper/state.go new file mode 100644 index 000000000..0ea73c8c1 --- /dev/null +++ b/x/checkpointing/keeper/state.go @@ -0,0 +1,104 @@ +package keeper + +import ( + "github.com/babylonchain/babylon/x/checkpointing/types" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +type BlsSigsState struct { + cdc codec.BinaryCodec + blsSigs sdk.KVStore + hashToEpoch sdk.KVStore +} + +func (k Keeper) BlsSigsState(ctx sdk.Context) BlsSigsState { + // Build the BlsSigsState storage + store := ctx.KVStore(k.storeKey) + return BlsSigsState{ + cdc: k.cdc, + blsSigs: prefix.NewStore(store, types.BlsSigsPrefix), + } +} + +// InsertBlsSig inserts a bls sig into storage +func (bs BlsSigsState) InsertBlsSig(sig *types.BlsSig) { + epoch := sig.GetEpochNum() + sigHash := sig.Hash() + blsSigsKey := types.BlsSigsObjectKey(epoch, sigHash) + epochKey := types.BlsSigsEpochKey(sigHash) + + bs.blsSigs.Set(blsSigsKey, bs.cdc.MustMarshal(sig)) + bs.hashToEpoch.Set(epochKey, sdk.Uint64ToBigEndian(epoch)) +} + +// GetBlsSig retrieves a bls sig by its epoch and hash +func (bs BlsSigsState) GetBlsSig(epoch uint64, hash types.BlsSigHash) (*types.BlsSig, error) { + blsSigsKey := types.BlsSigsObjectKey(epoch, hash) + bz := bs.blsSigs.Get(blsSigsKey) + if bz == nil { + return nil, types.ErrBlsSigDoesNotExist.Wrap("no header with provided height and hash") + } + + blsSig := new(types.BlsSig) + bs.cdc.MustUnmarshal(bz, blsSig) + return blsSig, nil +} + +// GetBlsSigByHash retrieves a bls sig by its hash +func (bs BlsSigsState) GetBlsSigByHash(hash types.BlsSigHash) (*types.BlsSig, error) { + epoch, err := bs.GetBlsSigEpoch(hash) + if err != nil { + return nil, err + } + return bs.GetBlsSig(epoch, hash) +} + +// GetBlsSigsByEpoch retrieves bls sigs by their epoch +func (bs BlsSigsState) GetBlsSigsByEpoch(epoch uint64) ([]*types.BlsSig, error) { + store := prefix.NewStore(bs.blsSigs, sdk.Uint64ToBigEndian(epoch)) + iter := store.Iterator(nil, nil) + defer iter.Close() + + blsSigs := make([]*types.BlsSig, 0) + for ; iter.Valid(); iter.Next() { + rawBytes := iter.Value() + blsSig := new(types.BlsSig) + bs.cdc.MustUnmarshal(rawBytes, blsSig) + blsSigs = append(blsSigs, blsSig) + } + if len(blsSigs) == 0 { + return nil, types.ErrBlsSigsEpochDoesNotExist.Wrap("no bls sigs with provided epoch") + } + return blsSigs, nil +} + +func (bs BlsSigsState) GetBlsSigEpoch(hash types.BlsSigHash) (uint64, error) { + hashKey := types.BlsSigsEpochKey(hash) + bz := bs.hashToEpoch.Get(hashKey) + if bz == nil { + return 0, types.ErrBlsSigDoesNotExist.Wrap("no bls sig with provided hash") + } + return sdk.BigEndianToUint64(bz), nil +} + +// Exists Check whether a hash is maintained in storage +func (bs BlsSigsState) Exists(hash types.BlsSigHash) bool { + _, err := bs.GetBlsSigEpoch(hash) + return err == nil +} + +type CheckpointsState struct { + cdc codec.BinaryCodec + checkpoints sdk.KVStore +} + +func (k Keeper) CheckpointsState(ctx sdk.Context) CheckpointsState { + // Build the CheckpointsState storage + store := ctx.KVStore(k.storeKey) + return CheckpointsState{ + cdc: k.cdc, + checkpoints: prefix.NewStore(store, types.CheckpointsPrefix), + } +} diff --git a/x/checkpointing/types/errors.go b/x/checkpointing/types/errors.go index 389c8e5ed..d17d7a840 100644 --- a/x/checkpointing/types/errors.go +++ b/x/checkpointing/types/errors.go @@ -1,4 +1,9 @@ package types +import sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + // x/checkpointing module sentinel errors -var () +var ( + ErrBlsSigDoesNotExist = sdkerrors.Register(ModuleName, 1100, "bls sig does not exist") + ErrBlsSigsEpochDoesNotExist = sdkerrors.Register(ModuleName, 1101, "bls sig epoch does not exist") +) diff --git a/x/checkpointing/types/expected_keepers.go b/x/checkpointing/types/expected_keepers.go index 6aa6e9778..28a9aa661 100644 --- a/x/checkpointing/types/expected_keepers.go +++ b/x/checkpointing/types/expected_keepers.go @@ -16,3 +16,13 @@ type BankKeeper interface { SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins // Methods imported from bank should be defined here } + +// StakingKeeper defines the expected interface needed to retrieve validator staking status +type StakingKeeper interface { + GetLastTotalPower(ctx sdk.Context) sdk.Uint +} + +// Epoching defines the expected interface needed to retrieve epoch info +type EpochingKeeper interface { + GetCurrentEpoch(ctx sdk.Context) sdk.Uint +} diff --git a/x/checkpointing/types/keys.go b/x/checkpointing/types/keys.go index 2c4e576d4..97b212e50 100644 --- a/x/checkpointing/types/keys.go +++ b/x/checkpointing/types/keys.go @@ -1,5 +1,7 @@ package types +import sdk "github.com/cosmos/cosmos-sdk/types" + const ( // ModuleName defines the module name ModuleName = "checkpointing" @@ -17,6 +19,29 @@ const ( MemStoreKey = "mem_checkpointing" ) +var ( + BlsSigsPrefix = []byte{0x0} // reserve this namespace for bls sigs + CheckpointsPrefix = []byte{0x1} // reserve this namespace for checkpoints + + BlsSigsObjectPrefix = append(BlsSigsPrefix, 0x0) // where we save the concrete bls sig bytes + BlsSigsHashToEpochPrefix = append(BlsSigsPrefix, 0x1) // where we map hash to epoch +) + +func BlsSigsObjectKey(epoch uint64, hash BlsSigHash) []byte { + ee := sdk.Uint64ToBigEndian(epoch) + epochPrefix := append(BlsSigsObjectPrefix, ee...) + return append(epochPrefix, hash...) +} + +func BlsSigsEpochKey(hash BlsSigHash) []byte { + return append(BlsSigsHashToEpochPrefix, hash...) +} + +func CheckpointsKey(epoch uint64) []byte { + ee := sdk.Uint64ToBigEndian(epoch) + return append(CheckpointsPrefix, ee...) +} + func KeyPrefix(p string) []byte { return []byte(p) } diff --git a/x/checkpointing/types/types.go b/x/checkpointing/types/types.go new file mode 100644 index 000000000..9c4d07887 --- /dev/null +++ b/x/checkpointing/types/types.go @@ -0,0 +1,3 @@ +package types + +type BlsSigHash []byte diff --git a/x/checkpointing/types/utils.go b/x/checkpointing/types/utils.go new file mode 100644 index 000000000..69290aee2 --- /dev/null +++ b/x/checkpointing/types/utils.go @@ -0,0 +1,13 @@ +package types + +import ( + "crypto/sha256" + "fmt" +) + +func (m BlsSig) Hash() BlsSigHash { + h := sha256.New() + h.Write([]byte(fmt.Sprintf("%v", m))) + + return h.Sum(nil) +} From eb4d99a9dbb6e1049684aafc59b2138d8623e28a Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Wed, 22 Jun 2022 23:21:48 +0800 Subject: [PATCH 09/16] added checkpointing keys --- x/checkpointing/keeper/state.go | 9 +++++++-- x/checkpointing/types/keys.go | 15 +++++++++++++-- x/checkpointing/types/types.go | 2 ++ x/checkpointing/types/utils.go | 7 +++++++ 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/x/checkpointing/keeper/state.go b/x/checkpointing/keeper/state.go index 0ea73c8c1..99e70b753 100644 --- a/x/checkpointing/keeper/state.go +++ b/x/checkpointing/keeper/state.go @@ -17,8 +17,9 @@ func (k Keeper) BlsSigsState(ctx sdk.Context) BlsSigsState { // Build the BlsSigsState storage store := ctx.KVStore(k.storeKey) return BlsSigsState{ - cdc: k.cdc, - blsSigs: prefix.NewStore(store, types.BlsSigsPrefix), + cdc: k.cdc, + blsSigs: prefix.NewStore(store, types.BlsSigsPrefix), + hashToEpoch: prefix.NewStore(store, types.BlsSigsHashToEpochPrefix), } } @@ -92,6 +93,7 @@ func (bs BlsSigsState) Exists(hash types.BlsSigHash) bool { type CheckpointsState struct { cdc codec.BinaryCodec checkpoints sdk.KVStore + hashToEpoch sdk.KVStore } func (k Keeper) CheckpointsState(ctx sdk.Context) CheckpointsState { @@ -100,5 +102,8 @@ func (k Keeper) CheckpointsState(ctx sdk.Context) CheckpointsState { return CheckpointsState{ cdc: k.cdc, checkpoints: prefix.NewStore(store, types.CheckpointsPrefix), + hashToEpoch: prefix.NewStore(store, types.CkptsHashToEpochPrefix), } } + +// TODO: add basic CheckpointsState methods diff --git a/x/checkpointing/types/keys.go b/x/checkpointing/types/keys.go index 97b212e50..682249d5a 100644 --- a/x/checkpointing/types/keys.go +++ b/x/checkpointing/types/keys.go @@ -25,8 +25,12 @@ var ( BlsSigsObjectPrefix = append(BlsSigsPrefix, 0x0) // where we save the concrete bls sig bytes BlsSigsHashToEpochPrefix = append(BlsSigsPrefix, 0x1) // where we map hash to epoch + + CkptsObjectPrefix = append(CheckpointsPrefix, 0x0) // where we save the concrete bls sig bytes + CkptsHashToEpochPrefix = append(CheckpointsPrefix, 0x1) // where we map hash to epoch ) +// BlsSigsObjectKey defines epoch + hash func BlsSigsObjectKey(epoch uint64, hash BlsSigHash) []byte { ee := sdk.Uint64ToBigEndian(epoch) epochPrefix := append(BlsSigsObjectPrefix, ee...) @@ -37,9 +41,16 @@ func BlsSigsEpochKey(hash BlsSigHash) []byte { return append(BlsSigsHashToEpochPrefix, hash...) } -func CheckpointsKey(epoch uint64) []byte { +// CkptsObjectKey defines epoch + status + hash +func CkptsObjectKey(epoch uint64, status string, hash RawCkptHash) []byte { ee := sdk.Uint64ToBigEndian(epoch) - return append(CheckpointsPrefix, ee...) + epochPrefix := append(CkptsObjectPrefix, ee...) + epochStatusPrefix := append(epochPrefix, []byte(status)...) + return append(epochStatusPrefix, hash...) +} + +func CkptsEpochKey(hash RawCkptHash) []byte { + return append(CkptsHashToEpochPrefix, hash...) } func KeyPrefix(p string) []byte { diff --git a/x/checkpointing/types/types.go b/x/checkpointing/types/types.go index 9c4d07887..6ce467cac 100644 --- a/x/checkpointing/types/types.go +++ b/x/checkpointing/types/types.go @@ -1,3 +1,5 @@ package types type BlsSigHash []byte + +type RawCkptHash []byte diff --git a/x/checkpointing/types/utils.go b/x/checkpointing/types/utils.go index 69290aee2..b63e17455 100644 --- a/x/checkpointing/types/utils.go +++ b/x/checkpointing/types/utils.go @@ -11,3 +11,10 @@ func (m BlsSig) Hash() BlsSigHash { return h.Sum(nil) } + +func (m RawCheckpoint) Hash() RawCkptHash { + h := sha256.New() + h.Write([]byte(fmt.Sprintf("%v", m))) + + return h.Sum(nil) +} From 65fe7e8ca40ec50e6451fe415f1f5127f1cca5da Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Thu, 23 Jun 2022 18:39:14 +0800 Subject: [PATCH 10/16] added checkpoint state functionalities --- proto/babylon/checkpointing/checkpoint.proto | 12 +- proto/babylon/checkpointing/query.proto | 2 +- x/btclightclient/keeper/state.go | 2 +- .../keeper/{state.go => blssig_state.go} | 67 +-- x/checkpointing/keeper/ckpt_state.go | 231 +++++++++ x/checkpointing/keeper/keeper.go | 2 +- x/checkpointing/types/checkpoint.pb.go | 93 ++-- x/checkpointing/types/errors.go | 12 +- x/checkpointing/types/keys.go | 23 +- x/checkpointing/types/query.pb.go | 437 ++++++++++++------ x/checkpointing/types/query.pb.gw.go | 10 +- x/checkpointing/types/types.go | 13 + x/checkpointing/types/utils.go | 51 +- x/epoching/types/query.pb.gw.go | 20 + 14 files changed, 702 insertions(+), 273 deletions(-) rename x/checkpointing/keeper/{state.go => blssig_state.go} (67%) create mode 100644 x/checkpointing/keeper/ckpt_state.go diff --git a/proto/babylon/checkpointing/checkpoint.proto b/proto/babylon/checkpointing/checkpoint.proto index 8109e200a..4f4706094 100644 --- a/proto/babylon/checkpointing/checkpoint.proto +++ b/proto/babylon/checkpointing/checkpoint.proto @@ -20,7 +20,7 @@ message RawCheckpoint { // bls_multi_sig defines the multi sig that is aggregated from individual bls sigs bytes bls_multi_sig = 4; // status defines the status of the checkpoint - RawCheckpointStatus status = 5; + uint32 status = 5; } // BlsSig wraps the bls sig with meta data. @@ -36,13 +36,3 @@ message BlsSig { // the signer_address defines the address of the signer string signer_address = 5; } - -// RawCheckpointStatus defines the status of the raw checkpoint -enum RawCheckpointStatus { - // UNCHECKPOINTED indicates the checkpoint has not appeared on BTC - UNCHECKPOINTED = 0; - // CHECKPOINTED_NOT_CONFIRMED indicates the checkpoint has been checkpointed on BTC but has insufficent confirmation - CHECKPOINTED_NOT_CONFIRMED = 1; - // CONFIRMED indicates the checkpoint has sufficient confirmation depth on BTC - CONFIRMED = 2; -} diff --git a/proto/babylon/checkpointing/query.proto b/proto/babylon/checkpointing/query.proto index f2b2b794c..80a84ffca 100644 --- a/proto/babylon/checkpointing/query.proto +++ b/proto/babylon/checkpointing/query.proto @@ -45,7 +45,7 @@ service Query { // RPC method. message QueryRawCheckpointListRequest { // status defines the status of the raw checkpoints of the query - RawCheckpointStatus status = 1; + uint32 status = 1; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; diff --git a/x/btclightclient/keeper/state.go b/x/btclightclient/keeper/state.go index 17034a567..f57ee9fc3 100644 --- a/x/btclightclient/keeper/state.go +++ b/x/btclightclient/keeper/state.go @@ -94,7 +94,7 @@ func (s HeadersState) GetHeadersByHeight(height uint64, f func(*wire.BlockHeader } stop := f(header) if stop { - break + return nil } } return nil diff --git a/x/checkpointing/keeper/state.go b/x/checkpointing/keeper/blssig_state.go similarity index 67% rename from x/checkpointing/keeper/state.go rename to x/checkpointing/keeper/blssig_state.go index 99e70b753..ffd877139 100644 --- a/x/checkpointing/keeper/state.go +++ b/x/checkpointing/keeper/blssig_state.go @@ -23,30 +23,42 @@ func (k Keeper) BlsSigsState(ctx sdk.Context) BlsSigsState { } } -// InsertBlsSig inserts a bls sig into storage -func (bs BlsSigsState) InsertBlsSig(sig *types.BlsSig) { +// CreateBlsSig inserts the bls sig into the hash->epoch and (epoch, hash)->bls sig storage +func (bs BlsSigsState) CreateBlsSig(sig *types.BlsSig) { epoch := sig.GetEpochNum() sigHash := sig.Hash() blsSigsKey := types.BlsSigsObjectKey(epoch, sigHash) epochKey := types.BlsSigsEpochKey(sigHash) + // save concrete bls sig object bs.blsSigs.Set(blsSigsKey, bs.cdc.MustMarshal(sig)) + // map bls sig to epoch bs.hashToEpoch.Set(epochKey, sdk.Uint64ToBigEndian(epoch)) } // GetBlsSig retrieves a bls sig by its epoch and hash func (bs BlsSigsState) GetBlsSig(epoch uint64, hash types.BlsSigHash) (*types.BlsSig, error) { blsSigsKey := types.BlsSigsObjectKey(epoch, hash) - bz := bs.blsSigs.Get(blsSigsKey) - if bz == nil { - return nil, types.ErrBlsSigDoesNotExist.Wrap("no header with provided height and hash") + rawBytes := bs.blsSigs.Get(blsSigsKey) + if rawBytes == nil { + return nil, types.ErrBlsSigDoesNotExist.Wrap("no header with provided epoch and hash") } blsSig := new(types.BlsSig) - bs.cdc.MustUnmarshal(bz, blsSig) + bs.cdc.MustUnmarshal(rawBytes, blsSig) return blsSig, nil } +// GetBlsSigEpoch retrieves the epoch of a bls sig +func (bs BlsSigsState) GetBlsSigEpoch(hash types.BlsSigHash) (uint64, error) { + hashKey := types.BlsSigsEpochKey(hash) + bz := bs.hashToEpoch.Get(hashKey) + if bz == nil { + return 0, types.ErrBlsSigDoesNotExist.Wrap("no bls sig with provided hash") + } + return sdk.BigEndianToUint64(bz), nil +} + // GetBlsSigByHash retrieves a bls sig by its hash func (bs BlsSigsState) GetBlsSigByHash(hash types.BlsSigHash) (*types.BlsSig, error) { epoch, err := bs.GetBlsSigEpoch(hash) @@ -57,53 +69,24 @@ func (bs BlsSigsState) GetBlsSigByHash(hash types.BlsSigHash) (*types.BlsSig, er } // GetBlsSigsByEpoch retrieves bls sigs by their epoch -func (bs BlsSigsState) GetBlsSigsByEpoch(epoch uint64) ([]*types.BlsSig, error) { +func (bs BlsSigsState) GetBlsSigsByEpoch(epoch uint64, f func(sig *types.BlsSig) bool) error { store := prefix.NewStore(bs.blsSigs, sdk.Uint64ToBigEndian(epoch)) iter := store.Iterator(nil, nil) defer iter.Close() - blsSigs := make([]*types.BlsSig, 0) for ; iter.Valid(); iter.Next() { rawBytes := iter.Value() blsSig := new(types.BlsSig) bs.cdc.MustUnmarshal(rawBytes, blsSig) - blsSigs = append(blsSigs, blsSig) - } - if len(blsSigs) == 0 { - return nil, types.ErrBlsSigsEpochDoesNotExist.Wrap("no bls sigs with provided epoch") - } - return blsSigs, nil -} - -func (bs BlsSigsState) GetBlsSigEpoch(hash types.BlsSigHash) (uint64, error) { - hashKey := types.BlsSigsEpochKey(hash) - bz := bs.hashToEpoch.Get(hashKey) - if bz == nil { - return 0, types.ErrBlsSigDoesNotExist.Wrap("no bls sig with provided hash") + stop := f(blsSig) + if stop { + break + } } - return sdk.BigEndianToUint64(bz), nil + return nil } // Exists Check whether a hash is maintained in storage func (bs BlsSigsState) Exists(hash types.BlsSigHash) bool { - _, err := bs.GetBlsSigEpoch(hash) - return err == nil + return bs.hashToEpoch.Has(types.BlsSigHashToBytes(hash)) } - -type CheckpointsState struct { - cdc codec.BinaryCodec - checkpoints sdk.KVStore - hashToEpoch sdk.KVStore -} - -func (k Keeper) CheckpointsState(ctx sdk.Context) CheckpointsState { - // Build the CheckpointsState storage - store := ctx.KVStore(k.storeKey) - return CheckpointsState{ - cdc: k.cdc, - checkpoints: prefix.NewStore(store, types.CheckpointsPrefix), - hashToEpoch: prefix.NewStore(store, types.CkptsHashToEpochPrefix), - } -} - -// TODO: add basic CheckpointsState methods diff --git a/x/checkpointing/keeper/ckpt_state.go b/x/checkpointing/keeper/ckpt_state.go new file mode 100644 index 000000000..093c337eb --- /dev/null +++ b/x/checkpointing/keeper/ckpt_state.go @@ -0,0 +1,231 @@ +package keeper + +import ( + "errors" + "github.com/babylonchain/babylon/x/checkpointing/types" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +type CheckpointsState struct { + cdc codec.BinaryCodec + checkpoints sdk.KVStore + hashToEpoch sdk.KVStore + hashToStatus sdk.KVStore + lastConfirmedEpoch sdk.KVStore + tipEpoch sdk.KVStore +} + +func (k Keeper) CheckpointsState(ctx sdk.Context) CheckpointsState { + // Build the CheckpointsState storage + store := ctx.KVStore(k.storeKey) + return CheckpointsState{ + cdc: k.cdc, + checkpoints: prefix.NewStore(store, types.CheckpointsPrefix), + hashToEpoch: prefix.NewStore(store, types.CkptsHashToEpochPrefix), + hashToStatus: prefix.NewStore(store, types.CkptsHashToStatusPrefix), + lastConfirmedEpoch: prefix.NewStore(store, types.CheckpointsPrefix), + tipEpoch: prefix.NewStore(store, types.CheckpointsPrefix), + } +} + +// CreateRawCkpt inserts the raw checkpoint into the hash->epoch, hash->status, and (epoch, status, hash)->ckpt storage +func (cs CheckpointsState) CreateRawCkpt(ckpt *types.RawCheckpoint) error { + ckptHash := ckpt.Hash() + ckptsKey := types.CkptsObjectKey(ckpt.EpochNum, ckpt.Status, ckptHash) + epochKey := types.CkptsEpochKey(ckptHash) + statusKey := types.CkptsStatusKey(ckptHash) + + // save concrete ckpt object + cs.checkpoints.Set(ckptsKey, cs.cdc.MustMarshal(ckpt)) + // map ckpt to epoch + cs.hashToEpoch.Set(epochKey, sdk.Uint64ToBigEndian(ckpt.EpochNum)) + // map ckpt to status + cs.hashToEpoch.Set(statusKey, types.Uint32ToBitEndian(ckpt.Status)) + + return cs.UpdateTipEpoch(ckpt.EpochNum) +} + +// GetRawCkpt retrieves a raw checkpoint by its epoch, status, and hash +func (cs CheckpointsState) GetRawCkpt(epoch uint64, status uint32, hash types.RawCkptHash) (*types.RawCheckpoint, error) { + ckptsKey := types.CkptsObjectKey(epoch, status, hash) + rawBytes := cs.checkpoints.Get(ckptsKey) + if rawBytes == nil { + return nil, types.ErrCkptDoesNotExist.Wrap("no raw checkpoint with provided epoch and hash") + } + + ckpt := new(types.RawCheckpoint) + cs.cdc.MustUnmarshal(rawBytes, ckpt) + + return ckpt, nil +} + +// GetRawCkptEpoch retrieves the epoch of a raw checkpoint +func (cs CheckpointsState) GetRawCkptEpoch(hash types.RawCkptHash) (uint64, error) { + epochKey := types.CkptsEpochKey(hash) + bz := cs.hashToEpoch.Get(epochKey) + if bz == nil { + return 0, types.ErrCkptsEpochDoesNotExist.Wrap("no checkpoint epoch with provided hash") + } + return sdk.BigEndianToUint64(bz), nil +} + +// GetRawCkptStatus retrieves the status of a raw checkpoint +func (cs CheckpointsState) GetRawCkptStatus(hash types.RawCkptHash) (uint32, error) { + statusKey := types.CkptsStatusKey(hash) + bz := cs.hashToStatus.Get(statusKey) + if bz == nil { + return 0, types.ErrCkptsStatusDoesNotExist.Wrap("no checkpoint status with provided hash") + } + return types.BigEndianToUint32(bz), nil +} + +// GetRawCkptByHash retrieves a raw checkpoint by its hash +func (cs CheckpointsState) GetRawCkptByHash(hash types.RawCkptHash) (*types.RawCheckpoint, error) { + epoch, err := cs.GetRawCkptEpoch(hash) + if err != nil { + return nil, err + } + status, err := cs.GetRawCkptStatus(hash) + if err != nil { + return nil, err + } + return cs.GetRawCkpt(epoch, status, hash) +} + +// GetRawCkptsByEpoch retrieves raw checkpoints by their epoch +func (cs CheckpointsState) GetRawCkptsByEpoch(epoch uint64) ([]*types.RawCheckpoint, error) { + ckpts := make([]*types.RawCheckpoint, 0) + for _, s := range types.RAW_CKPT_STATUS { + pf := append(sdk.Uint64ToBigEndian(epoch), types.Uint32ToBitEndian(s)...) + store := prefix.NewStore(cs.checkpoints, pf) + func() { + iter := store.Iterator(nil, nil) + defer iter.Close() + + for ; iter.Valid(); iter.Next() { + rawBytes := iter.Value() + ckpt := new(types.RawCheckpoint) + cs.cdc.MustUnmarshal(rawBytes, ckpt) + ckpts = append(ckpts, ckpt) + } + }() + } + if len(ckpts) == 0 { + return nil, types.ErrCkptsDoNotExist.Wrap("no raw checkpoints with provided epoch") + } + return ckpts, nil +} + +// GetRawCkptByStatus retrieves raw checkpoints by their status by the accending order of epoch +func (cs CheckpointsState) GetRawCkptByStatus(status uint32) ([]*types.RawCheckpoint, error) { + lce, err := cs.GetLastConfirmedEpoch() + if err != nil && status == types.CONFIRMED { + return nil, err + } + var startEpoch, endEpoch uint64 + if status == types.CONFIRMED { + // start from the beginning + startEpoch = 0 + endEpoch = lce + } else { + // start from lce + 1 + startEpoch = lce + 1 + endEpoch = cs.GetTipEpoch() + } + if endEpoch <= startEpoch { + return nil, types.ErrCkptsDoNotExist.Wrap("no raw checkpoints with provided status") + } + ckpts := make([]*types.RawCheckpoint, 0) + for e := startEpoch; e <= endEpoch; e++ { + pf := append(sdk.Uint64ToBigEndian(e), types.Uint32ToBitEndian(status)...) + store := prefix.NewStore(cs.checkpoints, pf) + func() { + iter := store.Iterator(nil, nil) + defer iter.Close() + + for ; iter.Valid(); iter.Next() { + rawBytes := iter.Value() + ckpt := new(types.RawCheckpoint) + cs.cdc.MustUnmarshal(rawBytes, ckpt) + ckpts = append(ckpts, ckpt) + } + }() + } + if len(ckpts) == 0 { + return nil, types.ErrCkptsDoNotExist.Wrap("no raw checkpoints with provided status") + } + return ckpts, nil +} + +// UpdateCkptStatus updates the checkpoint's status +func (cs CheckpointsState) UpdateCkptStatus(hash types.RawCkptHash, status uint32) error { + ckpt, err := cs.GetRawCkptByHash(hash) + if err != nil { + return err + } + ckpt.Status = status + epoch, err := cs.GetRawCkptEpoch(hash) + if err != nil { + return err + } + oldStatus, err := cs.GetRawCkptStatus(hash) + if err != nil { + return err + } + statusKey := types.CkptsStatusKey(hash) + ckptKey := types.CkptsObjectKey(epoch, oldStatus, hash) + cs.checkpoints.Set(ckptKey, cs.cdc.MustMarshal(ckpt)) + cs.hashToStatus.Set(statusKey, types.Uint32ToBitEndian(status)) + + if status == types.CONFIRMED { + err := cs.UpdateLastConfirmedEpoch(ckpt.EpochNum) + if err != nil { + return err + } + } + + return nil +} + +// GetLastConfirmedEpoch retrieves the last confirmed epoch +func (cs CheckpointsState) GetLastConfirmedEpoch() (uint64, error) { + if !cs.lastConfirmedEpoch.Has(types.LastConfirmedKey()) { + return 0, types.ErrLastConfirmedEpochDoesNotExist.Wrap("no last confirmed epoch found") + } + bz := cs.lastConfirmedEpoch.Get(types.LastConfirmedKey()) + return sdk.BigEndianToUint64(bz), nil +} + +func (cs CheckpointsState) UpdateLastConfirmedEpoch(epoch uint64) error { + e, err := cs.GetLastConfirmedEpoch() + if err != nil { + return err + } + if e >= epoch { + return errors.New("failed to update last confirmed epoch") + } + epochKey := types.LastConfirmedKey() + cs.lastConfirmedEpoch.Set(epochKey, sdk.Uint64ToBigEndian(epoch)) + return nil +} + +// GetTipEpoch returns the highest epoch that has created a raw checkpoint +func (cs CheckpointsState) GetTipEpoch() uint64 { + if !cs.tipEpoch.Has(types.TipKey()) { + return 0 + } + bz := cs.tipEpoch.Get(types.TipKey()) + return sdk.BigEndianToUint64(bz) +} + +func (cs CheckpointsState) UpdateTipEpoch(epoch uint64) error { + tipKey := types.TipKey() + te := sdk.BigEndianToUint64(cs.tipEpoch.Get(tipKey)) + if te >= epoch { + return errors.New("failed to update tip epoch") + } + cs.tipEpoch.Set(tipKey, sdk.Uint64ToBigEndian(epoch)) + return nil +} diff --git a/x/checkpointing/keeper/keeper.go b/x/checkpointing/keeper/keeper.go index b438b66a4..17b74e513 100644 --- a/x/checkpointing/keeper/keeper.go +++ b/x/checkpointing/keeper/keeper.go @@ -52,7 +52,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { func (k Keeper) AddBlsSig(ctx sdk.Context, sig *types.BlsSig) error { // TODO: some checks: 1. duplication check 2. epoch check 3. raw ckpt existence check // TODO: aggregate bls sigs and try to build raw checkpoints - k.BlsSigsState(ctx).InsertBlsSig(sig) + k.BlsSigsState(ctx).CreateBlsSig(sig) return nil } diff --git a/x/checkpointing/types/checkpoint.pb.go b/x/checkpointing/types/checkpoint.pb.go index 9c2a275be..fbd28b256 100644 --- a/x/checkpointing/types/checkpoint.pb.go +++ b/x/checkpointing/types/checkpoint.pb.go @@ -26,38 +26,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// RawCheckpointStatus defines the status of the raw checkpoint -type RawCheckpointStatus int32 - -const ( - // UNCHECKPOINTED indicates the checkpoint has not appeared on BTC - RawCheckpointStatus_UNCHECKPOINTED RawCheckpointStatus = 0 - // CHECKPOINTED_NOT_CONFIRMED indicates the checkpoint has been checkpointed on BTC but has insufficent confirmation - RawCheckpointStatus_CHECKPOINTED_NOT_CONFIRMED RawCheckpointStatus = 1 - // CONFIRMED indicates the checkpoint has sufficient confirmation depth on BTC - RawCheckpointStatus_CONFIRMED RawCheckpointStatus = 2 -) - -var RawCheckpointStatus_name = map[int32]string{ - 0: "UNCHECKPOINTED", - 1: "CHECKPOINTED_NOT_CONFIRMED", - 2: "CONFIRMED", -} - -var RawCheckpointStatus_value = map[string]int32{ - "UNCHECKPOINTED": 0, - "CHECKPOINTED_NOT_CONFIRMED": 1, - "CONFIRMED": 2, -} - -func (x RawCheckpointStatus) String() string { - return proto.EnumName(RawCheckpointStatus_name, int32(x)) -} - -func (RawCheckpointStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_63ff05f0a47b36f7, []int{0} -} - // RawCheckpoint wraps the multi sig with meta data. type RawCheckpoint struct { // epoch_num defines the epoch number the raw checkpoint is for @@ -69,7 +37,7 @@ type RawCheckpoint struct { // bls_multi_sig defines the multi sig that is aggregated from individual bls sigs BlsMultiSig []byte `protobuf:"bytes,4,opt,name=bls_multi_sig,json=blsMultiSig,proto3" json:"bls_multi_sig,omitempty"` // status defines the status of the checkpoint - Status RawCheckpointStatus `protobuf:"varint,5,opt,name=status,proto3,enum=babylon.checkpointing.v1.RawCheckpointStatus" json:"status,omitempty"` + Status uint32 `protobuf:"varint,5,opt,name=status,proto3" json:"status,omitempty"` } func (m *RawCheckpoint) Reset() { *m = RawCheckpoint{} } @@ -133,11 +101,11 @@ func (m *RawCheckpoint) GetBlsMultiSig() []byte { return nil } -func (m *RawCheckpoint) GetStatus() RawCheckpointStatus { +func (m *RawCheckpoint) GetStatus() uint32 { if m != nil { return m.Status } - return RawCheckpointStatus_UNCHECKPOINTED + return 0 } // BlsSig wraps the bls sig with meta data. @@ -216,7 +184,6 @@ func (m *BlsSig) GetSignerAddress() string { } func init() { - proto.RegisterEnum("babylon.checkpointing.v1.RawCheckpointStatus", RawCheckpointStatus_name, RawCheckpointStatus_value) proto.RegisterType((*RawCheckpoint)(nil), "babylon.checkpointing.v1.RawCheckpoint") proto.RegisterType((*BlsSig)(nil), "babylon.checkpointing.v1.BlsSig") } @@ -226,34 +193,30 @@ func init() { } var fileDescriptor_63ff05f0a47b36f7 = []byte{ - // 432 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0x41, 0x8b, 0xd4, 0x30, - 0x14, 0xc7, 0x27, 0xeb, 0x38, 0x3a, 0xd1, 0x29, 0x43, 0x14, 0xad, 0x23, 0x74, 0x87, 0x01, 0xa5, - 0x08, 0xb6, 0xa8, 0x78, 0xf1, 0xe6, 0x76, 0x2b, 0xbb, 0xc8, 0xb6, 0xd2, 0x5d, 0x41, 0xbc, 0x84, - 0xa4, 0x5b, 0xd3, 0x60, 0xd3, 0x94, 0x49, 0xaa, 0xee, 0xa7, 0xd0, 0x8f, 0xe0, 0xc7, 0xf1, 0xb8, - 0x47, 0x6f, 0xca, 0xcc, 0xc5, 0x8f, 0x21, 0x4d, 0xba, 0xba, 0x23, 0x7a, 0xf3, 0xd6, 0xff, 0x2f, - 0xff, 0xf7, 0xfa, 0x7f, 0x8f, 0x07, 0xef, 0x52, 0x42, 0x4f, 0x2a, 0x59, 0x87, 0x79, 0x59, 0xe4, - 0x6f, 0x1b, 0xc9, 0x6b, 0xcd, 0x6b, 0x76,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ff, 0x69, 0xb4, - 0x9b, 0xf0, 0x52, 0x37, 0x42, 0x17, 0xfe, 0x6c, 0x36, 0xdb, 0xff, 0x0e, 0x74, 0x14, 0x67, 0x75, - 0xb1, 0xc4, 0xe4, 0xf8, 0x78, 0x59, 0x28, 0x9b, 0x7f, 0x9c, 0x4d, 0x2c, 0x7d, 0x6a, 0xe1, 0xbd, - 0x57, 0xf0, 0xda, 0x5f, 0x62, 0x23, 0x04, 0x9d, 0x97, 0x49, 0xb4, 0x17, 0x47, 0xcf, 0x5f, 0xa4, - 0xfb, 0xc9, 0x51, 0xbc, 0x3b, 0x1d, 0x20, 0x0f, 0xce, 0xce, 0x13, 0x9c, 0xa4, 0x47, 0x38, 0x4a, - 0x93, 0x67, 0xfb, 0xd9, 0x41, 0xbc, 0x3b, 0x05, 0x68, 0x02, 0xc7, 0xbf, 0xe5, 0xd6, 0x4e, 0xfa, - 0x65, 0xe5, 0x81, 0xd3, 0x95, 0x07, 0xbe, 0xaf, 0x3c, 0xf0, 0x69, 0xed, 0x0d, 0x4e, 0xd7, 0xde, - 0xe0, 0xeb, 0xda, 0x1b, 0xbc, 0x7e, 0xcc, 0xb8, 0x2e, 0x5b, 0x1a, 0xe4, 0x52, 0x84, 0xfd, 0x32, - 0xf3, 0x92, 0xf0, 0xfa, 0x4c, 0x84, 0x1f, 0xfe, 0xb8, 0x4a, 0x7d, 0xd2, 0x14, 0x8a, 0x8e, 0xcc, - 0x95, 0x3c, 0xfa, 0x19, 0x00, 0x00, 0xff, 0xff, 0x04, 0x11, 0x89, 0xc1, 0xbb, 0x02, 0x00, 0x00, + // 361 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0xb1, 0x4e, 0xeb, 0x30, + 0x14, 0x86, 0xeb, 0x7b, 0x4b, 0xa1, 0x86, 0x54, 0x28, 0x42, 0x10, 0x8a, 0x94, 0x56, 0x95, 0x40, + 0x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7, 0x64, 0x0f, 0xb0, 0x45, 0x33, 0x88, 0x44, 0x99, + 0x29, 0x1e, 0x01, 0x67, 0x4e, 0x53, 0x8f, 0xd7, 0x69, 0x06, 0xe7, 0x95, 0xbb, 0xe2, 0xac, 0xda, + 0x05, 0x45, 0x54, 0x09, 0xce, 0x4a, 0x1f, 0x79, 0x56, 0x58, 0xd3, 0x49, 0xf3, 0xe3, 0xb9, 0x87, + 0x06, 0x8f, 0x08, 0xb7, 0x86, 0x19, 0x54, 0xc1, 0x3f, 0xea, 0xba, 0x83, 0x57, 0xab, 0x4e, 0x55, + 0x9b, 0x65, 0x59, 0xf3, 0xfe, 0x7d, 0xdc, 0x01, 0xce, 0xf2, 0x64, 0x12, 0x91, 0xf1, 0x78, 0x92, + 0x80, 0x29, 0xd4, 0x0e, 0x2d, 0x63, 0x4f, 0x8d, 0x1c, 0x5e, 0xbe, 0xce, 0x5d, 0x34, 0x9b, 0xbb, + 0xe8, 0x7d, 0xee, 0xa2, 0xa7, 0x85, 0xdb, 0x98, 0x2d, 0xdc, 0xc6, 0xdb, 0xc2, 0x6d, 0x5c, 0x1f, + 0x33, 0xae, 0xd2, 0x92, 0xfa, 0xb1, 0x14, 0x41, 0x7d, 0xd5, 0x38, 0x25, 0x3c, 0x5f, 0x42, 0xf0, + 0xf0, 0xeb, 0x67, 0x50, 0xd3, 0x22, 0x01, 0xda, 0xd2, 0xc7, 0x39, 0xfa, 0x0c, 0x00, 0x00, 0xff, + 0xff, 0xbf, 0x3d, 0xd2, 0xac, 0x32, 0x02, 0x00, 0x00, } func (this *RawCheckpoint) Equal(that interface{}) bool { @@ -627,7 +590,7 @@ func (m *RawCheckpoint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Status |= RawCheckpointStatus(b&0x7F) << shift + m.Status |= uint32(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/checkpointing/types/errors.go b/x/checkpointing/types/errors.go index d17d7a840..4d655e4ef 100644 --- a/x/checkpointing/types/errors.go +++ b/x/checkpointing/types/errors.go @@ -4,6 +4,14 @@ import sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" // x/checkpointing module sentinel errors var ( - ErrBlsSigDoesNotExist = sdkerrors.Register(ModuleName, 1100, "bls sig does not exist") - ErrBlsSigsEpochDoesNotExist = sdkerrors.Register(ModuleName, 1101, "bls sig epoch does not exist") + ErrBlsSigDoesNotExist = sdkerrors.Register(ModuleName, 1200, "bls sig does not exist") + ErrBlsSigsDoNotExist = sdkerrors.Register(ModuleName, 1201, "bls sigs do not exist") + ErrBlsSigsEpochDoesNotExist = sdkerrors.Register(ModuleName, 1202, "bls sig epoch does not exist") + + ErrCkptDoesNotExist = sdkerrors.Register(ModuleName, 1203, "raw checkpoint does not exist") + ErrCkptsDoNotExist = sdkerrors.Register(ModuleName, 1204, "raw checkpoints do not exist") + ErrCkptsEpochDoesNotExist = sdkerrors.Register(ModuleName, 1205, "raw checkpoint epoch does not exist") + ErrCkptsStatusDoesNotExist = sdkerrors.Register(ModuleName, 1206, "raw checkpoint status does not exist") + + ErrLastConfirmedEpochDoesNotExist = sdkerrors.Register(ModuleName, 1207, "last confirmed epoch does not exist") ) diff --git a/x/checkpointing/types/keys.go b/x/checkpointing/types/keys.go index 682249d5a..8730c9e99 100644 --- a/x/checkpointing/types/keys.go +++ b/x/checkpointing/types/keys.go @@ -26,8 +26,11 @@ var ( BlsSigsObjectPrefix = append(BlsSigsPrefix, 0x0) // where we save the concrete bls sig bytes BlsSigsHashToEpochPrefix = append(BlsSigsPrefix, 0x1) // where we map hash to epoch - CkptsObjectPrefix = append(CheckpointsPrefix, 0x0) // where we save the concrete bls sig bytes - CkptsHashToEpochPrefix = append(CheckpointsPrefix, 0x1) // where we map hash to epoch + CkptsObjectPrefix = append(CheckpointsPrefix, 0x0) // where we save the concrete bls sig bytes + CkptsHashToEpochPrefix = append(CheckpointsPrefix, 0x1) // where we map hash to epoch + CkptsHashToStatusPrefix = append(CheckpointsPrefix, 0x2) // where we map hash to status + TipPrefix = append(CheckpointsPrefix, 0x3) // where we store the tip epoch + LastConfirmedPrefix = append(CheckpointsPrefix, 0x4) // where we store the last confirmed epoch ) // BlsSigsObjectKey defines epoch + hash @@ -42,10 +45,10 @@ func BlsSigsEpochKey(hash BlsSigHash) []byte { } // CkptsObjectKey defines epoch + status + hash -func CkptsObjectKey(epoch uint64, status string, hash RawCkptHash) []byte { +func CkptsObjectKey(epoch uint64, status uint32, hash RawCkptHash) []byte { ee := sdk.Uint64ToBigEndian(epoch) epochPrefix := append(CkptsObjectPrefix, ee...) - epochStatusPrefix := append(epochPrefix, []byte(status)...) + epochStatusPrefix := append(epochPrefix, Uint32ToBitEndian(status)...) return append(epochStatusPrefix, hash...) } @@ -53,6 +56,18 @@ func CkptsEpochKey(hash RawCkptHash) []byte { return append(CkptsHashToEpochPrefix, hash...) } +func CkptsStatusKey(hash RawCkptHash) []byte { + return append(CkptsHashToStatusPrefix, hash...) +} + +func TipKey() []byte { + return TipPrefix +} + +func LastConfirmedKey() []byte { + return LastConfirmedPrefix +} + func KeyPrefix(p string) []byte { return []byte(p) } diff --git a/x/checkpointing/types/query.pb.go b/x/checkpointing/types/query.pb.go index 21479c3ed..4a1e9abf8 100644 --- a/x/checkpointing/types/query.pb.go +++ b/x/checkpointing/types/query.pb.go @@ -34,7 +34,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // RPC method. type QueryRawCheckpointListRequest struct { // status defines the status of the raw checkpoints of the query - Status RawCheckpointStatus `protobuf:"varint,1,opt,name=status,proto3,enum=babylon.checkpointing.v1.RawCheckpointStatus" json:"status,omitempty"` + Status uint32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"` // pagination defines an optional pagination for the request. Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -72,11 +72,11 @@ func (m *QueryRawCheckpointListRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryRawCheckpointListRequest proto.InternalMessageInfo -func (m *QueryRawCheckpointListRequest) GetStatus() RawCheckpointStatus { +func (m *QueryRawCheckpointListRequest) GetStatus() uint32 { if m != nil { return m.Status } - return RawCheckpointStatus_UNCHECKPOINTED + return 0 } func (m *QueryRawCheckpointListRequest) GetPagination() *query.PageRequest { @@ -490,11 +490,7 @@ func (m *QueryBlsPublicKeyListRequest) GetPagination() *query.PageRequest { // QueryBlsPublicKeyListResponse is the response type for the Query/BlsPublicKeys // RPC method. type QueryBlsPublicKeyListResponse struct { - BlsPubKeys [][]byte `protobuf:"bytes,1,rep,name=bls_pub_keys,json=blsPubKeys,proto3" json:"bls_pub_keys,omitempty"` - // the signer_address defines the address of the signer - // will change to use cosmos_proto.scalar when we use cosmos v0.46.x - // string signer_address = 5 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - SignerAddress string `protobuf:"bytes,5,opt,name=signer_address,json=signerAddress,proto3" json:"signer_address,omitempty"` + ValidatorWithBlsKeys []*ValidatorWithBlsKey `protobuf:"bytes,1,rep,name=validator_with_bls_keys,json=validatorWithBlsKeys,proto3" json:"validator_with_bls_keys,omitempty"` // pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -532,20 +528,13 @@ func (m *QueryBlsPublicKeyListResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryBlsPublicKeyListResponse proto.InternalMessageInfo -func (m *QueryBlsPublicKeyListResponse) GetBlsPubKeys() [][]byte { +func (m *QueryBlsPublicKeyListResponse) GetValidatorWithBlsKeys() []*ValidatorWithBlsKey { if m != nil { - return m.BlsPubKeys + return m.ValidatorWithBlsKeys } return nil } -func (m *QueryBlsPublicKeyListResponse) GetSignerAddress() string { - if m != nil { - return m.SignerAddress - } - return "" -} - func (m *QueryBlsPublicKeyListResponse) GetPagination() *query.PageResponse { if m != nil { return m.Pagination @@ -636,6 +625,59 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } +// ValidatorWithBlsKey couples validator address and its bls public key +type ValidatorWithBlsKey struct { + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + BlsPubKey []byte `protobuf:"bytes,2,opt,name=bls_pub_key,json=blsPubKey,proto3" json:"bls_pub_key,omitempty"` +} + +func (m *ValidatorWithBlsKey) Reset() { *m = ValidatorWithBlsKey{} } +func (m *ValidatorWithBlsKey) String() string { return proto.CompactTextString(m) } +func (*ValidatorWithBlsKey) ProtoMessage() {} +func (*ValidatorWithBlsKey) Descriptor() ([]byte, []int) { + return fileDescriptor_a0fdb8f0f85bb51e, []int{12} +} +func (m *ValidatorWithBlsKey) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValidatorWithBlsKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValidatorWithBlsKey.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 *ValidatorWithBlsKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorWithBlsKey.Merge(m, src) +} +func (m *ValidatorWithBlsKey) XXX_Size() int { + return m.Size() +} +func (m *ValidatorWithBlsKey) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorWithBlsKey.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorWithBlsKey proto.InternalMessageInfo + +func (m *ValidatorWithBlsKey) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress + } + return "" +} + +func (m *ValidatorWithBlsKey) GetBlsPubKey() []byte { + if m != nil { + return m.BlsPubKey + } + return nil +} + func init() { proto.RegisterType((*QueryRawCheckpointListRequest)(nil), "babylon.checkpointing.v1.QueryRawCheckpointListRequest") proto.RegisterType((*QueryRawCheckpointListResponse)(nil), "babylon.checkpointing.v1.QueryRawCheckpointListResponse") @@ -649,64 +691,67 @@ func init() { proto.RegisterType((*QueryBlsPublicKeyListResponse)(nil), "babylon.checkpointing.v1.QueryBlsPublicKeyListResponse") proto.RegisterType((*QueryParamsRequest)(nil), "babylon.checkpointing.v1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "babylon.checkpointing.v1.QueryParamsResponse") + proto.RegisterType((*ValidatorWithBlsKey)(nil), "babylon.checkpointing.v1.ValidatorWithBlsKey") } func init() { proto.RegisterFile("babylon/checkpointing/query.proto", fileDescriptor_a0fdb8f0f85bb51e) } var fileDescriptor_a0fdb8f0f85bb51e = []byte{ - // 822 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x96, 0x4f, 0x4f, 0xe3, 0x46, - 0x18, 0xc6, 0x33, 0x14, 0x22, 0x18, 0x20, 0x85, 0x29, 0x52, 0xd3, 0x94, 0xba, 0xa9, 0x4b, 0x21, - 0x6a, 0x8b, 0xad, 0x84, 0xbf, 0xaa, 0x0a, 0x12, 0x20, 0x5a, 0x55, 0x20, 0x9a, 0xba, 0xed, 0xa5, - 0x97, 0x68, 0x6c, 0xa6, 0x8e, 0x85, 0xe3, 0x31, 0x1e, 0x1b, 0x1a, 0x21, 0x2e, 0xed, 0x07, 0x68, - 0x25, 0xbe, 0x47, 0xa5, 0xde, 0x2a, 0xed, 0x69, 0xf7, 0xc4, 0x11, 0x69, 0x2f, 0x7b, 0x5a, 0xad, - 0xc8, 0x7e, 0x8f, 0x5d, 0x65, 0x66, 0x02, 0x38, 0x89, 0x13, 0xb2, 0xcb, 0x61, 0x6f, 0xc9, 0xcc, - 0xfb, 0xbe, 0xf9, 0x3d, 0xcf, 0x8c, 0x1f, 0x07, 0x7e, 0x66, 0x62, 0xb3, 0xee, 0x52, 0x4f, 0xb7, - 0xaa, 0xc4, 0x3a, 0xf2, 0xa9, 0xe3, 0x85, 0x8e, 0x67, 0xeb, 0xc7, 0x11, 0x09, 0xea, 0x9a, 0x1f, - 0xd0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b5, 0x0f, 0x48, 0x42, 0xb4, 0xe5, 0xd6, 0x06, 0xee, 0x93, 0x1a, 0x96, 0xb8, - 0x86, 0x45, 0xf4, 0x55, 0xb2, 0x86, 0x8e, 0x48, 0x6c, 0x3e, 0x20, 0x53, 0xed, 0x31, 0xd2, 0x17, - 0x3d, 0x21, 0xfd, 0xfa, 0xa2, 0x27, 0xe5, 0x95, 0xba, 0xc1, 0xd1, 0xd7, 0xd0, 0x4a, 0x32, 0xba, - 0xcc, 0x33, 0xd7, 0xb1, 0x78, 0xa4, 0xc5, 0xfc, 0xff, 0x1b, 0xc0, 0xb4, 0x08, 0x02, 0xf4, 0x75, - 0x1f, 0x84, 0x58, 0xfe, 0xe4, 0x16, 0xef, 0x59, 0x2d, 0x31, 0x0b, 0x1c, 0x53, 0x45, 0xf9, 0x64, - 0x4c, 0x91, 0x40, 0xdb, 0x3f, 0x5e, 0x5e, 0x2b, 0xe0, 0xea, 0x5a, 0x01, 0x2f, 0xae, 0x15, 0xf0, - 0x4f, 0x43, 0x49, 0x5d, 0x35, 0x94, 0xd4, 0xb3, 0x86, 0x92, 0xfa, 0x6d, 0xc5, 0x76, 0xc2, 0x6a, - 0x64, 0x6a, 0x16, 0xad, 0xb5, 0xa6, 0x58, 0x55, 0xec, 0x78, 0x37, 0x23, 0xff, 0x68, 0x1b, 0x1a, - 0xd6, 0x7d, 0xc2, 0xcc, 0x34, 0xff, 0x23, 0xba, 0xf4, 0x3a, 0x00, 0x00, 0xff, 0xff, 0x00, 0x10, - 0xb1, 0x70, 0x73, 0x0b, 0x00, 0x00, + // 852 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x96, 0xdd, 0x6e, 0xf3, 0x34, + 0x1c, 0xc6, 0x9b, 0x97, 0x97, 0x6a, 0xf3, 0x3e, 0xe8, 0xbc, 0x89, 0x8d, 0x32, 0x42, 0x09, 0xd3, + 0x56, 0x31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, 0xd8, 0xc0, 0x77, 0x47, 0x20, 0xc4, + 0x32, 0x2e, 0xbf, 0xf1, 0xc8, 0xd5, 0x02, 0xb3, 0xc8, 0x31, 0x15, 0x58, 0x48, 0xc7, 0x8c, 0x52, + 0xae, 0xf2, 0xc9, 0xcd, 0x9d, 0x2c, 0xdd, 0xde, 0xc9, 0xd2, 0x5f, 0x77, 0xb2, 0xf4, 0x63, 0x47, + 0xce, 0xdc, 0x76, 0xe4, 0xcc, 0x1f, 0x1d, 0x39, 0xf3, 0xd5, 0xb6, 0x65, 0xb3, 0x46, 0x60, 0xa8, + 0x26, 0x69, 0x76, 0xbb, 0x98, 0x0d, 0x64, 0xbb, 0xf7, 0x2d, 0xbf, 0xe9, 0x6b, 0xca, 0xda, 0x1e, + 0xa6, 0x46, 0x96, 0xff, 0xb3, 0xdd, 0xfc, 0x37, 0x00, 0x00, 0xff, 0xff, 0x7c, 0xa2, 0xc8, 0x63, + 0xc4, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1340,13 +1385,6 @@ func (m *QueryBlsPublicKeyListResponse) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l - if len(m.SignerAddress) > 0 { - i -= len(m.SignerAddress) - copy(dAtA[i:], m.SignerAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.SignerAddress))) - i-- - dAtA[i] = 0x2a - } if m.Pagination != nil { { size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) @@ -1359,11 +1397,16 @@ func (m *QueryBlsPublicKeyListResponse) MarshalToSizedBuffer(dAtA []byte) (int, i-- dAtA[i] = 0x12 } - if len(m.BlsPubKeys) > 0 { - for iNdEx := len(m.BlsPubKeys) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.BlsPubKeys[iNdEx]) - copy(dAtA[i:], m.BlsPubKeys[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.BlsPubKeys[iNdEx]))) + if len(m.ValidatorWithBlsKeys) > 0 { + for iNdEx := len(m.ValidatorWithBlsKeys) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ValidatorWithBlsKeys[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa } @@ -1427,6 +1470,43 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ValidatorWithBlsKey) 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 *ValidatorWithBlsKey) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorWithBlsKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BlsPubKey) > 0 { + i -= len(m.BlsPubKey) + copy(dAtA[i:], m.BlsPubKey) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BlsPubKey))) + i-- + dAtA[i] = 0x12 + } + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -1577,9 +1657,9 @@ func (m *QueryBlsPublicKeyListResponse) Size() (n int) { } var l int _ = l - if len(m.BlsPubKeys) > 0 { - for _, b := range m.BlsPubKeys { - l = len(b) + if len(m.ValidatorWithBlsKeys) > 0 { + for _, e := range m.ValidatorWithBlsKeys { + l = e.Size() n += 1 + l + sovQuery(uint64(l)) } } @@ -1587,10 +1667,6 @@ func (m *QueryBlsPublicKeyListResponse) Size() (n int) { l = m.Pagination.Size() n += 1 + l + sovQuery(uint64(l)) } - l = len(m.SignerAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } return n } @@ -1614,6 +1690,23 @@ func (m *QueryParamsResponse) Size() (n int) { return n } +func (m *ValidatorWithBlsKey) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.BlsPubKey) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1663,7 +1756,7 @@ func (m *QueryRawCheckpointListRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Status |= RawCheckpointStatus(b&0x7F) << shift + m.Status |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -2497,9 +2590,9 @@ func (m *QueryBlsPublicKeyListResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlsPubKeys", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorWithBlsKeys", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -2509,23 +2602,25 @@ func (m *QueryBlsPublicKeyListResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.BlsPubKeys = append(m.BlsPubKeys, make([]byte, postIndex-iNdEx)) - copy(m.BlsPubKeys[len(m.BlsPubKeys)-1], dAtA[iNdEx:postIndex]) + m.ValidatorWithBlsKeys = append(m.ValidatorWithBlsKeys, &ValidatorWithBlsKey{}) + if err := m.ValidatorWithBlsKeys[len(m.ValidatorWithBlsKeys)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { @@ -2563,38 +2658,6 @@ func (m *QueryBlsPublicKeyListResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SignerAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SignerAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -2749,6 +2812,122 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *ValidatorWithBlsKey) 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: ValidatorWithBlsKey: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValidatorWithBlsKey: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlsPubKey", 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.BlsPubKey = append(m.BlsPubKey[:0], dAtA[iNdEx:postIndex]...) + if m.BlsPubKey == nil { + m.BlsPubKey = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/checkpointing/types/query.pb.gw.go b/x/checkpointing/types/query.pb.gw.go index 98420a2c2..1eaec6da5 100644 --- a/x/checkpointing/types/query.pb.gw.go +++ b/x/checkpointing/types/query.pb.gw.go @@ -41,7 +41,6 @@ func request_Query_RawCheckpointList_0(ctx context.Context, marshaler runtime.Ma var ( val string - e int32 ok bool err error _ = err @@ -52,14 +51,12 @@ func request_Query_RawCheckpointList_0(ctx context.Context, marshaler runtime.Ma return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status") } - e, err = runtime.Enum(val, RawCheckpointStatus_value) + protoReq.Status, err = runtime.Uint32(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status", err) } - protoReq.Status = RawCheckpointStatus(e) - if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -78,7 +75,6 @@ func local_request_Query_RawCheckpointList_0(ctx context.Context, marshaler runt var ( val string - e int32 ok bool err error _ = err @@ -89,14 +85,12 @@ func local_request_Query_RawCheckpointList_0(ctx context.Context, marshaler runt return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status") } - e, err = runtime.Enum(val, RawCheckpointStatus_value) + protoReq.Status, err = runtime.Uint32(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status", err) } - protoReq.Status = RawCheckpointStatus(e) - if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } diff --git a/x/checkpointing/types/types.go b/x/checkpointing/types/types.go index 6ce467cac..0c9633d72 100644 --- a/x/checkpointing/types/types.go +++ b/x/checkpointing/types/types.go @@ -3,3 +3,16 @@ package types type BlsSigHash []byte type RawCkptHash []byte + +type CkptStatus uint32 + +const ( + // UNCHECKPOINTED indicates the checkpoint has not appeared on BTC + UNCHECKPOINTED uint32 = 0 + // CHECKPOINTED_NOT_CONFIRMED indicates the checkpoint has been checkpointed on BTC but has insufficent confirmation + CHECKPOINTED_NOT_CONFIRMED = 1 + // CONFIRMED indicates the checkpoint has sufficient confirmation depth on BTC + CONFIRMED = 2 +) + +var RAW_CKPT_STATUS = [3]uint32{UNCHECKPOINTED, CHECKPOINTED_NOT_CONFIRMED, CONFIRMED} diff --git a/x/checkpointing/types/utils.go b/x/checkpointing/types/utils.go index b63e17455..4d191118c 100644 --- a/x/checkpointing/types/utils.go +++ b/x/checkpointing/types/utils.go @@ -1,20 +1,53 @@ package types import ( - "crypto/sha256" - "fmt" + "encoding/binary" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/tendermint/tendermint/crypto/tmhash" ) func (m BlsSig) Hash() BlsSigHash { - h := sha256.New() - h.Write([]byte(fmt.Sprintf("%v", m))) - - return h.Sum(nil) + fields := [][]byte{ + m.LastCommitHash, + m.BlsSig, + sdk.Uint64ToBigEndian(m.EpochNum), + []byte(m.SignerAddress), + } + return hash(fields) } func (m RawCheckpoint) Hash() RawCkptHash { - h := sha256.New() - h.Write([]byte(fmt.Sprintf("%v", m))) + fields := [][]byte{ + m.LastCommitHash, + sdk.Uint64ToBigEndian(m.EpochNum), + m.Bitmap, + m.BlsMultiSig, + } + return hash(fields) +} + +func hash(fields [][]byte) []byte { + var bz []byte + for _, b := range fields { + bz = append(bz, b...) + } + return tmhash.Sum(bz) +} + +func BlsSigHashToBytes(h BlsSigHash) []byte { + return h +} + +func Uint32ToBitEndian(i uint32) []byte { + b := make([]byte, 4) + binary.BigEndian.PutUint32(b, i) + return b +} + +func BigEndianToUint32(bz []byte) uint32 { + if len(bz) == 0 { + return 0 + } - return h.Sum(nil) + return binary.BigEndian.Uint32(bz) } diff --git a/x/epoching/types/query.pb.gw.go b/x/epoching/types/query.pb.gw.go index 92f91ab69..0e889d1d4 100644 --- a/x/epoching/types/query.pb.gw.go +++ b/x/epoching/types/query.pb.gw.go @@ -125,6 +125,26 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_CurrentEpoch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_CurrentEpoch_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + forward_Query_CurrentEpoch_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) From 121c227de24083f604604682b29e13be4f55aea4 Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Thu, 23 Jun 2022 18:47:06 +0800 Subject: [PATCH 11/16] add keeper implement --- x/checkpointing/keeper/keeper.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/x/checkpointing/keeper/keeper.go b/x/checkpointing/keeper/keeper.go index 17b74e513..a80226e6f 100644 --- a/x/checkpointing/keeper/keeper.go +++ b/x/checkpointing/keeper/keeper.go @@ -56,6 +56,12 @@ func (k Keeper) AddBlsSig(ctx sdk.Context, sig *types.BlsSig) error { return nil } -func (k Keeper) AddCheckpoint(ctx sdk.Context, epoch uint64, ckpt *types.RawCheckpoint) error { - panic("implement this") +func (k Keeper) AddCheckpoint(ctx sdk.Context, ckpt *types.RawCheckpoint) error { + // TODO: some checks + return k.CheckpointsState(ctx).CreateRawCkpt(ckpt) +} + +func (k Keeper) UpdateCkptStatus(ctx sdk.Context, hash types.RawCkptHash, status uint32) error { + // TODO: some checks + return k.CheckpointsState(ctx).UpdateCkptStatus(hash, status) } From 70e20221c40b6400dca31239af483c920006bc77 Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Sun, 26 Jun 2022 22:33:43 +0800 Subject: [PATCH 12/16] refactor ckpt state --- proto/babylon/checkpointing/checkpoint.proto | 14 +- x/checkpointing/keeper/blssig_state.go | 52 ++---- x/checkpointing/keeper/ckpt_state.go | 186 +++++-------------- x/checkpointing/keeper/keeper.go | 28 ++- x/checkpointing/types/checkpoint.pb.go | 97 +++++++--- x/checkpointing/types/errors.go | 12 +- x/checkpointing/types/keys.go | 33 ++-- x/checkpointing/types/types.go | 20 +- x/checkpointing/types/utils.go | 25 +-- 9 files changed, 198 insertions(+), 269 deletions(-) diff --git a/proto/babylon/checkpointing/checkpoint.proto b/proto/babylon/checkpointing/checkpoint.proto index 4f4706094..35cea0328 100644 --- a/proto/babylon/checkpointing/checkpoint.proto +++ b/proto/babylon/checkpointing/checkpoint.proto @@ -20,7 +20,7 @@ message RawCheckpoint { // bls_multi_sig defines the multi sig that is aggregated from individual bls sigs bytes bls_multi_sig = 4; // status defines the status of the checkpoint - uint32 status = 5; + CkptStatus status = 5; } // BlsSig wraps the bls sig with meta data. @@ -36,3 +36,15 @@ message BlsSig { // the signer_address defines the address of the signer string signer_address = 5; } + +// CkptStatus is the status of a checkpoint. +enum CkptStatus{ + option (gogoproto.goproto_enum_prefix) = false; + + // UNCHECKPOINTED defines a checkpoint that is checkpointed on BTC. + CKPT_STATUS_UNCHECKPOINTED = 0 [(gogoproto.enumvalue_customname) = "Uncheckpointed"]; + // UNCONFIRMED defines a validator that is checkpointed on BTC but not confirmed. + CKPT_STATUS_UNCONFIRMED = 1 [(gogoproto.enumvalue_customname) = "Unconfirmed"]; + // CONFIRMED defines a validator that is confirmed on BTC. + CKPT_STATUS_CONFIRMED = 2 [(gogoproto.enumvalue_customname) = "Confirmed"]; +} diff --git a/x/checkpointing/keeper/blssig_state.go b/x/checkpointing/keeper/blssig_state.go index ffd877139..a75c5feb8 100644 --- a/x/checkpointing/keeper/blssig_state.go +++ b/x/checkpointing/keeper/blssig_state.go @@ -31,43 +31,11 @@ func (bs BlsSigsState) CreateBlsSig(sig *types.BlsSig) { epochKey := types.BlsSigsEpochKey(sigHash) // save concrete bls sig object - bs.blsSigs.Set(blsSigsKey, bs.cdc.MustMarshal(sig)) + bs.blsSigs.Set(blsSigsKey, bs.SerializeBlsSig(sig)) // map bls sig to epoch bs.hashToEpoch.Set(epochKey, sdk.Uint64ToBigEndian(epoch)) } -// GetBlsSig retrieves a bls sig by its epoch and hash -func (bs BlsSigsState) GetBlsSig(epoch uint64, hash types.BlsSigHash) (*types.BlsSig, error) { - blsSigsKey := types.BlsSigsObjectKey(epoch, hash) - rawBytes := bs.blsSigs.Get(blsSigsKey) - if rawBytes == nil { - return nil, types.ErrBlsSigDoesNotExist.Wrap("no header with provided epoch and hash") - } - - blsSig := new(types.BlsSig) - bs.cdc.MustUnmarshal(rawBytes, blsSig) - return blsSig, nil -} - -// GetBlsSigEpoch retrieves the epoch of a bls sig -func (bs BlsSigsState) GetBlsSigEpoch(hash types.BlsSigHash) (uint64, error) { - hashKey := types.BlsSigsEpochKey(hash) - bz := bs.hashToEpoch.Get(hashKey) - if bz == nil { - return 0, types.ErrBlsSigDoesNotExist.Wrap("no bls sig with provided hash") - } - return sdk.BigEndianToUint64(bz), nil -} - -// GetBlsSigByHash retrieves a bls sig by its hash -func (bs BlsSigsState) GetBlsSigByHash(hash types.BlsSigHash) (*types.BlsSig, error) { - epoch, err := bs.GetBlsSigEpoch(hash) - if err != nil { - return nil, err - } - return bs.GetBlsSig(epoch, hash) -} - // GetBlsSigsByEpoch retrieves bls sigs by their epoch func (bs BlsSigsState) GetBlsSigsByEpoch(epoch uint64, f func(sig *types.BlsSig) bool) error { store := prefix.NewStore(bs.blsSigs, sdk.Uint64ToBigEndian(epoch)) @@ -76,8 +44,7 @@ func (bs BlsSigsState) GetBlsSigsByEpoch(epoch uint64, f func(sig *types.BlsSig) for ; iter.Valid(); iter.Next() { rawBytes := iter.Value() - blsSig := new(types.BlsSig) - bs.cdc.MustUnmarshal(rawBytes, blsSig) + blsSig := bs.DeserializeBlsSig(rawBytes) stop := f(blsSig) if stop { break @@ -86,7 +53,18 @@ func (bs BlsSigsState) GetBlsSigsByEpoch(epoch uint64, f func(sig *types.BlsSig) return nil } -// Exists Check whether a hash is maintained in storage +// Exists Check whether a bls sig is maintained in storage func (bs BlsSigsState) Exists(hash types.BlsSigHash) bool { - return bs.hashToEpoch.Has(types.BlsSigHashToBytes(hash)) + store := prefix.NewStore(bs.hashToEpoch, types.BlsSigsHashToEpochPrefix) + return store.Has(hash.Bytes()) +} + +func (bs BlsSigsState) SerializeBlsSig(sig *types.BlsSig) []byte { + return bs.cdc.MustMarshal(sig) +} + +func (bs BlsSigsState) DeserializeBlsSig(rawSigBytes []byte) *types.BlsSig { + sig := new(types.BlsSig) + bs.cdc.MustUnmarshal(rawSigBytes, sig) + return sig } diff --git a/x/checkpointing/keeper/ckpt_state.go b/x/checkpointing/keeper/ckpt_state.go index 093c337eb..5e29a8f02 100644 --- a/x/checkpointing/keeper/ckpt_state.go +++ b/x/checkpointing/keeper/ckpt_state.go @@ -11,8 +11,6 @@ import ( type CheckpointsState struct { cdc codec.BinaryCodec checkpoints sdk.KVStore - hashToEpoch sdk.KVStore - hashToStatus sdk.KVStore lastConfirmedEpoch sdk.KVStore tipEpoch sdk.KVStore } @@ -23,186 +21,90 @@ func (k Keeper) CheckpointsState(ctx sdk.Context) CheckpointsState { return CheckpointsState{ cdc: k.cdc, checkpoints: prefix.NewStore(store, types.CheckpointsPrefix), - hashToEpoch: prefix.NewStore(store, types.CkptsHashToEpochPrefix), - hashToStatus: prefix.NewStore(store, types.CkptsHashToStatusPrefix), lastConfirmedEpoch: prefix.NewStore(store, types.CheckpointsPrefix), tipEpoch: prefix.NewStore(store, types.CheckpointsPrefix), } } -// CreateRawCkpt inserts the raw checkpoint into the hash->epoch, hash->status, and (epoch, status, hash)->ckpt storage +// CreateRawCkpt inserts the raw checkpoint into the storage by its epoch number func (cs CheckpointsState) CreateRawCkpt(ckpt *types.RawCheckpoint) error { - ckptHash := ckpt.Hash() - ckptsKey := types.CkptsObjectKey(ckpt.EpochNum, ckpt.Status, ckptHash) - epochKey := types.CkptsEpochKey(ckptHash) - statusKey := types.CkptsStatusKey(ckptHash) - // save concrete ckpt object - cs.checkpoints.Set(ckptsKey, cs.cdc.MustMarshal(ckpt)) - // map ckpt to epoch - cs.hashToEpoch.Set(epochKey, sdk.Uint64ToBigEndian(ckpt.EpochNum)) - // map ckpt to status - cs.hashToEpoch.Set(statusKey, types.Uint32ToBitEndian(ckpt.Status)) + cs.checkpoints.Set(types.CkptsObjectKey(ckpt.EpochNum), cs.cdc.MustMarshal(ckpt)) return cs.UpdateTipEpoch(ckpt.EpochNum) } -// GetRawCkpt retrieves a raw checkpoint by its epoch, status, and hash -func (cs CheckpointsState) GetRawCkpt(epoch uint64, status uint32, hash types.RawCkptHash) (*types.RawCheckpoint, error) { - ckptsKey := types.CkptsObjectKey(epoch, status, hash) +// GetRawCkpt retrieves a raw checkpoint by its epoch number +func (cs CheckpointsState) GetRawCkpt(epoch uint64) (*types.RawCheckpoint, error) { + ckptsKey := types.CkptsObjectKey(epoch) rawBytes := cs.checkpoints.Get(ckptsKey) if rawBytes == nil { - return nil, types.ErrCkptDoesNotExist.Wrap("no raw checkpoint with provided epoch and hash") + return nil, types.ErrCkptDoesNotExist.Wrap("no raw checkpoint with provided epoch") } - ckpt := new(types.RawCheckpoint) - cs.cdc.MustUnmarshal(rawBytes, ckpt) - - return ckpt, nil + return cs.DeserializeCkpt(rawBytes), nil } -// GetRawCkptEpoch retrieves the epoch of a raw checkpoint -func (cs CheckpointsState) GetRawCkptEpoch(hash types.RawCkptHash) (uint64, error) { - epochKey := types.CkptsEpochKey(hash) - bz := cs.hashToEpoch.Get(epochKey) - if bz == nil { - return 0, types.ErrCkptsEpochDoesNotExist.Wrap("no checkpoint epoch with provided hash") - } - return sdk.BigEndianToUint64(bz), nil -} - -// GetRawCkptStatus retrieves the status of a raw checkpoint -func (cs CheckpointsState) GetRawCkptStatus(hash types.RawCkptHash) (uint32, error) { - statusKey := types.CkptsStatusKey(hash) - bz := cs.hashToStatus.Get(statusKey) - if bz == nil { - return 0, types.ErrCkptsStatusDoesNotExist.Wrap("no checkpoint status with provided hash") - } - return types.BigEndianToUint32(bz), nil -} - -// GetRawCkptByHash retrieves a raw checkpoint by its hash -func (cs CheckpointsState) GetRawCkptByHash(hash types.RawCkptHash) (*types.RawCheckpoint, error) { - epoch, err := cs.GetRawCkptEpoch(hash) - if err != nil { - return nil, err - } - status, err := cs.GetRawCkptStatus(hash) - if err != nil { - return nil, err - } - return cs.GetRawCkpt(epoch, status, hash) -} - -// GetRawCkptsByEpoch retrieves raw checkpoints by their epoch -func (cs CheckpointsState) GetRawCkptsByEpoch(epoch uint64) ([]*types.RawCheckpoint, error) { - ckpts := make([]*types.RawCheckpoint, 0) - for _, s := range types.RAW_CKPT_STATUS { - pf := append(sdk.Uint64ToBigEndian(epoch), types.Uint32ToBitEndian(s)...) - store := prefix.NewStore(cs.checkpoints, pf) - func() { - iter := store.Iterator(nil, nil) - defer iter.Close() - - for ; iter.Valid(); iter.Next() { - rawBytes := iter.Value() - ckpt := new(types.RawCheckpoint) - cs.cdc.MustUnmarshal(rawBytes, ckpt) - ckpts = append(ckpts, ckpt) - } - }() - } - if len(ckpts) == 0 { - return nil, types.ErrCkptsDoNotExist.Wrap("no raw checkpoints with provided epoch") - } - return ckpts, nil -} - -// GetRawCkptByStatus retrieves raw checkpoints by their status by the accending order of epoch -func (cs CheckpointsState) GetRawCkptByStatus(status uint32) ([]*types.RawCheckpoint, error) { - lce, err := cs.GetLastConfirmedEpoch() - if err != nil && status == types.CONFIRMED { - return nil, err - } +// GetRawCkptsByStatus retrieves raw checkpoints by their status by the accending order of epoch +func (cs CheckpointsState) GetRawCkptsByStatus(status types.CkptStatus) ([]*types.RawCheckpoint, error) { var startEpoch, endEpoch uint64 - if status == types.CONFIRMED { - // start from the beginning + lce := cs.GetLastConfirmedEpoch() + if status == types.Confirmed { + endEpoch = cs.GetLastConfirmedEpoch() startEpoch = 0 - endEpoch = lce } else { - // start from lce + 1 startEpoch = lce + 1 endEpoch = cs.GetTipEpoch() } if endEpoch <= startEpoch { return nil, types.ErrCkptsDoNotExist.Wrap("no raw checkpoints with provided status") } - ckpts := make([]*types.RawCheckpoint, 0) - for e := startEpoch; e <= endEpoch; e++ { - pf := append(sdk.Uint64ToBigEndian(e), types.Uint32ToBitEndian(status)...) - store := prefix.NewStore(cs.checkpoints, pf) - func() { - iter := store.Iterator(nil, nil) - defer iter.Close() - - for ; iter.Valid(); iter.Next() { - rawBytes := iter.Value() - ckpt := new(types.RawCheckpoint) - cs.cdc.MustUnmarshal(rawBytes, ckpt) - ckpts = append(ckpts, ckpt) - } - }() - } - if len(ckpts) == 0 { - return nil, types.ErrCkptsDoNotExist.Wrap("no raw checkpoints with provided status") + return cs.getRawCkptsByEpochRangeWithStatus(startEpoch, endEpoch, status) +} + +func (cs CheckpointsState) getRawCkptsByEpochRangeWithStatus(start uint64, endEpoch uint64, status types.CkptStatus) ([]*types.RawCheckpoint, error) { + ckptList := make([]*types.RawCheckpoint, endEpoch-start) + for i := start; i <= endEpoch; i++ { + ckpt, err := cs.GetRawCkpt(i) + if err != nil { + return nil, err + } + if status == ckpt.Status { + ckptList = append(ckptList, ckpt) + } } - return ckpts, nil + + return ckptList, nil } // UpdateCkptStatus updates the checkpoint's status -func (cs CheckpointsState) UpdateCkptStatus(hash types.RawCkptHash, status uint32) error { - ckpt, err := cs.GetRawCkptByHash(hash) - if err != nil { - return err - } - ckpt.Status = status - epoch, err := cs.GetRawCkptEpoch(hash) - if err != nil { - return err - } - oldStatus, err := cs.GetRawCkptStatus(hash) +func (cs CheckpointsState) UpdateCkptStatus(rawCkptBytes []byte, status types.CkptStatus) error { + ckpt := cs.DeserializeCkpt(rawCkptBytes) + c, err := cs.GetRawCkpt(ckpt.EpochNum) if err != nil { + // the checkpoint should exist return err } - statusKey := types.CkptsStatusKey(hash) - ckptKey := types.CkptsObjectKey(epoch, oldStatus, hash) - cs.checkpoints.Set(ckptKey, cs.cdc.MustMarshal(ckpt)) - cs.hashToStatus.Set(statusKey, types.Uint32ToBitEndian(status)) - - if status == types.CONFIRMED { - err := cs.UpdateLastConfirmedEpoch(ckpt.EpochNum) - if err != nil { - return err - } + if !c.Hash().Equals(ckpt.Hash()) { + return errors.New("hash not the same with existing checkpoint") } + ckpt.Status = status + cs.checkpoints.Set(sdk.Uint64ToBigEndian(ckpt.EpochNum), cs.cdc.MustMarshal(ckpt)) return nil } // GetLastConfirmedEpoch retrieves the last confirmed epoch -func (cs CheckpointsState) GetLastConfirmedEpoch() (uint64, error) { +func (cs CheckpointsState) GetLastConfirmedEpoch() uint64 { if !cs.lastConfirmedEpoch.Has(types.LastConfirmedKey()) { - return 0, types.ErrLastConfirmedEpochDoesNotExist.Wrap("no last confirmed epoch found") + return 0 } bz := cs.lastConfirmedEpoch.Get(types.LastConfirmedKey()) - return sdk.BigEndianToUint64(bz), nil + return sdk.BigEndianToUint64(bz) } func (cs CheckpointsState) UpdateLastConfirmedEpoch(epoch uint64) error { - e, err := cs.GetLastConfirmedEpoch() - if err != nil { - return err - } + e := cs.GetLastConfirmedEpoch() if e >= epoch { return errors.New("failed to update last confirmed epoch") } @@ -229,3 +131,13 @@ func (cs CheckpointsState) UpdateTipEpoch(epoch uint64) error { cs.tipEpoch.Set(tipKey, sdk.Uint64ToBigEndian(epoch)) return nil } + +func (cs CheckpointsState) DeserializeCkpt(rawCkptBytes []byte) *types.RawCheckpoint { + ckpt := new(types.RawCheckpoint) + cs.cdc.MustUnmarshal(rawCkptBytes, ckpt) + return ckpt +} + +func (cs CheckpointsState) SerializeCkpt(ckpt *types.RawCheckpoint) []byte { + return cs.cdc.MustMarshal(ckpt) +} diff --git a/x/checkpointing/keeper/keeper.go b/x/checkpointing/keeper/keeper.go index a80226e6f..4fcd531f1 100644 --- a/x/checkpointing/keeper/keeper.go +++ b/x/checkpointing/keeper/keeper.go @@ -49,6 +49,8 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } +// AddBlsSig add bls signatures into storage and generates a raw checkpoint +// if sufficient sigs are accumulated for a specific epoch func (k Keeper) AddBlsSig(ctx sdk.Context, sig *types.BlsSig) error { // TODO: some checks: 1. duplication check 2. epoch check 3. raw ckpt existence check // TODO: aggregate bls sigs and try to build raw checkpoints @@ -56,12 +58,30 @@ func (k Keeper) AddBlsSig(ctx sdk.Context, sig *types.BlsSig) error { return nil } -func (k Keeper) AddCheckpoint(ctx sdk.Context, ckpt *types.RawCheckpoint) error { - // TODO: some checks +// AddRawCheckpoint adds a raw checkpoint into the storage +// this API may not needed since checkpoints are generated internally +func (k Keeper) AddRawCheckpoint(ctx sdk.Context, ckpt *types.RawCheckpoint) error { + // NOTE: may remove this API return k.CheckpointsState(ctx).CreateRawCkpt(ckpt) } -func (k Keeper) UpdateCkptStatus(ctx sdk.Context, hash types.RawCkptHash, status uint32) error { +// CheckpointEpoch verifies checkpoint from BTC and returns epoch number +func (k Keeper) CheckpointEpoch(ctx sdk.Context, rawCkptBytes []byte) (uint64, error) { + ckpt := k.CheckpointsState(ctx).DeserializeCkpt(rawCkptBytes) + err := k.verifyRawCheckpoint(ckpt) + if err != nil { + return 0, err + } + return ckpt.EpochNum, nil +} + +func (k Keeper) verifyRawCheckpoint(ckpt *types.RawCheckpoint) error { + // TODO: verify checkpoint basic and bls multi-sig + return nil +} + +// UpdateCkptStatus updates the status of a raw checkpoint +func (k Keeper) UpdateCkptStatus(ctx sdk.Context, rawCkptBytes []byte, status types.CkptStatus) error { // TODO: some checks - return k.CheckpointsState(ctx).UpdateCkptStatus(hash, status) + return k.CheckpointsState(ctx).UpdateCkptStatus(rawCkptBytes, status) } diff --git a/x/checkpointing/types/checkpoint.pb.go b/x/checkpointing/types/checkpoint.pb.go index fbd28b256..ed8d414ce 100644 --- a/x/checkpointing/types/checkpoint.pb.go +++ b/x/checkpointing/types/checkpoint.pb.go @@ -26,6 +26,38 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// CkptStatus is the status of a checkpoint. +type CkptStatus int32 + +const ( + // UNCHECKPOINTED defines a checkpoint that is checkpointed on BTC. + Uncheckpointed CkptStatus = 0 + // UNCONFIRMED defines a validator that is checkpointed on BTC but not confirmed. + Unconfirmed CkptStatus = 1 + // CONFIRMED defines a validator that is confirmed on BTC. + Confirmed CkptStatus = 2 +) + +var CkptStatus_name = map[int32]string{ + 0: "CKPT_STATUS_UNCHECKPOINTED", + 1: "CKPT_STATUS_UNCONFIRMED", + 2: "CKPT_STATUS_CONFIRMED", +} + +var CkptStatus_value = map[string]int32{ + "CKPT_STATUS_UNCHECKPOINTED": 0, + "CKPT_STATUS_UNCONFIRMED": 1, + "CKPT_STATUS_CONFIRMED": 2, +} + +func (x CkptStatus) String() string { + return proto.EnumName(CkptStatus_name, int32(x)) +} + +func (CkptStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_63ff05f0a47b36f7, []int{0} +} + // RawCheckpoint wraps the multi sig with meta data. type RawCheckpoint struct { // epoch_num defines the epoch number the raw checkpoint is for @@ -37,7 +69,7 @@ type RawCheckpoint struct { // bls_multi_sig defines the multi sig that is aggregated from individual bls sigs BlsMultiSig []byte `protobuf:"bytes,4,opt,name=bls_multi_sig,json=blsMultiSig,proto3" json:"bls_multi_sig,omitempty"` // status defines the status of the checkpoint - Status uint32 `protobuf:"varint,5,opt,name=status,proto3" json:"status,omitempty"` + Status CkptStatus `protobuf:"varint,5,opt,name=status,proto3,enum=babylon.checkpointing.v1.CkptStatus" json:"status,omitempty"` } func (m *RawCheckpoint) Reset() { *m = RawCheckpoint{} } @@ -101,11 +133,11 @@ func (m *RawCheckpoint) GetBlsMultiSig() []byte { return nil } -func (m *RawCheckpoint) GetStatus() uint32 { +func (m *RawCheckpoint) GetStatus() CkptStatus { if m != nil { return m.Status } - return 0 + return Uncheckpointed } // BlsSig wraps the bls sig with meta data. @@ -184,6 +216,7 @@ func (m *BlsSig) GetSignerAddress() string { } func init() { + proto.RegisterEnum("babylon.checkpointing.v1.CkptStatus", CkptStatus_name, CkptStatus_value) proto.RegisterType((*RawCheckpoint)(nil), "babylon.checkpointing.v1.RawCheckpoint") proto.RegisterType((*BlsSig)(nil), "babylon.checkpointing.v1.BlsSig") } @@ -193,30 +226,38 @@ func init() { } var fileDescriptor_63ff05f0a47b36f7 = []byte{ - // 361 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0xb1, 0x4e, 0xeb, 0x30, - 0x14, 0x86, 0xeb, 0x7b, 0x4b, 0xa1, 0x86, 0x54, 0x28, 0x42, 0x10, 0x8a, 0x94, 0x56, 0x95, 0x40, - 0x99, 0x12, 0x21, 0xc4, 0xc2, 0x46, 0xbb, 0xb0, 0x00, 0x52, 0xd8, 0x58, 0x22, 0x3b, 0x0d, 0x8e, - 0x45, 0x1c, 0x47, 0x3d, 0x0e, 0xd0, 0xa7, 0x80, 0x47, 0xe0, 0x11, 0x78, 0x0c, 0xc6, 0x8e, 0x8c, - 0xa8, 0x5d, 0x78, 0x0c, 0x14, 0x3b, 0x45, 0xc0, 0xcc, 0x96, 0xef, 0x3b, 0xff, 0x49, 0x7e, 0xe9, - 0x04, 0x1f, 0x50, 0x42, 0xa7, 0x99, 0xcc, 0x83, 0x38, 0x4d, 0xe2, 0xdb, 0x42, 0xf2, 0x5c, 0xf1, - 0x9c, 0x7d, 0x23, 0xbf, 0x98, 0x48, 0x25, 0x6d, 0xa7, 0xce, 0xf9, 0x3f, 0x72, 0xfe, 0xdd, 0x61, - 0x77, 0x37, 0x96, 0x20, 0x24, 0x44, 0x3a, 0x17, 0x18, 0x30, 0x4b, 0xdd, 0x2d, 0x26, 0x99, 0x34, - 0xbe, 0x7a, 0xaa, 0x6d, 0x8f, 0x49, 0xc9, 0xb2, 0x24, 0xd0, 0x44, 0xcb, 0x9b, 0x40, 0x71, 0x91, - 0x80, 0x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xd5, 0x38, 0x25, 0x3c, 0x5f, 0x42, 0xf0, - 0xf0, 0xeb, 0x67, 0x50, 0xd3, 0x22, 0x01, 0xda, 0xd2, 0xc7, 0x39, 0xfa, 0x0c, 0x00, 0x00, 0xff, - 0xff, 0xbf, 0x3d, 0xd2, 0xac, 0x32, 0x02, 0x00, 0x00, + // 487 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0x4f, 0x6f, 0xd3, 0x30, + 0x18, 0x87, 0xeb, 0x51, 0x0a, 0xf5, 0x68, 0xa9, 0x2c, 0x60, 0x21, 0x48, 0x59, 0x54, 0x01, 0x8a, + 0x10, 0x4a, 0xc4, 0x10, 0x17, 0xc4, 0x65, 0xcb, 0x8a, 0x36, 0x4d, 0x6b, 0xa7, 0xb4, 0xbd, 0x70, + 0x89, 0x9c, 0x34, 0x73, 0xac, 0xc5, 0x76, 0x54, 0x3b, 0xc0, 0xbe, 0x01, 0xea, 0x05, 0xbe, 0x40, + 0x11, 0x12, 0x5f, 0x86, 0xe3, 0x4e, 0x88, 0x23, 0x6a, 0x2f, 0x7c, 0x0c, 0x94, 0x3f, 0xa5, 0x63, + 0x12, 0x37, 0x6e, 0xf9, 0x3d, 0x7e, 0x5e, 0xe7, 0x7d, 0x93, 0x17, 0x3e, 0x0e, 0x70, 0x70, 0x9e, + 0x08, 0xee, 0x84, 0x71, 0x14, 0x9e, 0xa5, 0x82, 0x72, 0x45, 0x39, 0xb9, 0x94, 0xec, 0x74, 0x2a, + 0x94, 0x40, 0x5a, 0xe5, 0xd9, 0x7f, 0x79, 0xf6, 0xdb, 0x67, 0xfa, 0xfd, 0x50, 0x48, 0x26, 0xa4, + 0x5f, 0x78, 0x4e, 0x19, 0xca, 0x22, 0xfd, 0x0e, 0x11, 0x44, 0x94, 0x3c, 0x7f, 0xaa, 0xe8, 0x36, + 0x11, 0x82, 0x24, 0x91, 0x53, 0xa4, 0x20, 0x3b, 0x75, 0x14, 0x65, 0x91, 0x54, 0x98, 0xa5, 0xa5, + 0xd0, 0xfd, 0x0e, 0x60, 0xcb, 0xc3, 0xef, 0xdc, 0x3f, 0x6f, 0x42, 0x0f, 0x60, 0x33, 0x4a, 0x45, + 0x18, 0xfb, 0x3c, 0x63, 0x1a, 0x30, 0x81, 0x55, 0xf7, 0x6e, 0x16, 0xa0, 0x9f, 0x31, 0x64, 0xc1, + 0x4e, 0x82, 0xa5, 0xf2, 0x43, 0xc1, 0x18, 0x55, 0x7e, 0x8c, 0x65, 0xac, 0x6d, 0x98, 0xc0, 0xba, + 0xe5, 0xb5, 0x73, 0xee, 0x16, 0xf8, 0x00, 0xcb, 0x18, 0xdd, 0x83, 0x8d, 0x80, 0x2a, 0x86, 0x53, + 0xed, 0x5a, 0x71, 0x5e, 0x25, 0xd4, 0x85, 0xad, 0x20, 0x91, 0x3e, 0xcb, 0x12, 0x45, 0x7d, 0x49, + 0x89, 0x56, 0x2f, 0x8e, 0x37, 0x83, 0x44, 0x1e, 0xe7, 0x6c, 0x48, 0x09, 0x7a, 0x05, 0x1b, 0x52, + 0x61, 0x95, 0x49, 0xed, 0xba, 0x09, 0xac, 0xf6, 0xce, 0x43, 0xfb, 0x5f, 0x5f, 0xc4, 0x76, 0xcf, + 0x52, 0x35, 0x2c, 0x5c, 0xaf, 0xaa, 0x79, 0x59, 0xff, 0xf5, 0x65, 0x1b, 0x74, 0x3f, 0x02, 0xd8, + 0xd8, 0x4b, 0x64, 0x7e, 0xdd, 0x7f, 0x9a, 0x68, 0x0b, 0xde, 0xc8, 0x3b, 0xcf, 0x7b, 0x5e, 0x8d, + 0x54, 0xde, 0xff, 0x08, 0xb6, 0x25, 0x25, 0x3c, 0x9a, 0xfa, 0x78, 0x32, 0x99, 0x46, 0xb2, 0x6c, + 0xbb, 0xe9, 0xb5, 0x4a, 0xba, 0x5b, 0xc2, 0x27, 0x9f, 0x01, 0x84, 0xeb, 0x76, 0xd1, 0x0e, 0xd4, + 0xdd, 0xa3, 0x93, 0x91, 0x3f, 0x1c, 0xed, 0x8e, 0xc6, 0x43, 0x7f, 0xdc, 0x77, 0x0f, 0x7a, 0xee, + 0xd1, 0xc9, 0xe0, 0xb0, 0x3f, 0xea, 0xed, 0x77, 0x6a, 0x3a, 0x9a, 0xcd, 0xcd, 0xf6, 0x98, 0xaf, + 0x27, 0x8e, 0x26, 0xe8, 0x29, 0xdc, 0xba, 0x52, 0x33, 0xe8, 0xbf, 0x3e, 0xf4, 0x8e, 0x7b, 0xfb, + 0x1d, 0xa0, 0xdf, 0x9e, 0xcd, 0xcd, 0xcd, 0x31, 0x0f, 0x05, 0x3f, 0xa5, 0x53, 0x16, 0x4d, 0x90, + 0x05, 0xef, 0x5e, 0xb6, 0xd7, 0xee, 0x86, 0xde, 0x9a, 0xcd, 0xcd, 0xa6, 0xbb, 0x32, 0xf5, 0xfa, + 0x87, 0xaf, 0x46, 0x6d, 0x6f, 0xf0, 0x6d, 0x61, 0x80, 0x8b, 0x85, 0x01, 0x7e, 0x2e, 0x0c, 0xf0, + 0x69, 0x69, 0xd4, 0x2e, 0x96, 0x46, 0xed, 0xc7, 0xd2, 0xa8, 0xbd, 0x79, 0x41, 0xa8, 0x8a, 0xb3, + 0xc0, 0x0e, 0x05, 0x73, 0xaa, 0x5f, 0x11, 0xc6, 0x98, 0xf2, 0x55, 0x70, 0xde, 0x5f, 0xd9, 0x69, + 0x75, 0x9e, 0x46, 0x32, 0x68, 0x14, 0x3b, 0xf6, 0xfc, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1a, + 0xcb, 0x8e, 0xe0, 0xf9, 0x02, 0x00, 0x00, } func (this *RawCheckpoint) Equal(that interface{}) bool { @@ -590,7 +631,7 @@ func (m *RawCheckpoint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Status |= uint32(b&0x7F) << shift + m.Status |= CkptStatus(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/checkpointing/types/errors.go b/x/checkpointing/types/errors.go index 4d655e4ef..c8a0c3383 100644 --- a/x/checkpointing/types/errors.go +++ b/x/checkpointing/types/errors.go @@ -4,14 +4,6 @@ import sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" // x/checkpointing module sentinel errors var ( - ErrBlsSigDoesNotExist = sdkerrors.Register(ModuleName, 1200, "bls sig does not exist") - ErrBlsSigsDoNotExist = sdkerrors.Register(ModuleName, 1201, "bls sigs do not exist") - ErrBlsSigsEpochDoesNotExist = sdkerrors.Register(ModuleName, 1202, "bls sig epoch does not exist") - - ErrCkptDoesNotExist = sdkerrors.Register(ModuleName, 1203, "raw checkpoint does not exist") - ErrCkptsDoNotExist = sdkerrors.Register(ModuleName, 1204, "raw checkpoints do not exist") - ErrCkptsEpochDoesNotExist = sdkerrors.Register(ModuleName, 1205, "raw checkpoint epoch does not exist") - ErrCkptsStatusDoesNotExist = sdkerrors.Register(ModuleName, 1206, "raw checkpoint status does not exist") - - ErrLastConfirmedEpochDoesNotExist = sdkerrors.Register(ModuleName, 1207, "last confirmed epoch does not exist") + ErrCkptDoesNotExist = sdkerrors.Register(ModuleName, 1201, "raw checkpoint does not exist") + ErrCkptsDoNotExist = sdkerrors.Register(ModuleName, 1202, "raw checkpoints do not exist") ) diff --git a/x/checkpointing/types/keys.go b/x/checkpointing/types/keys.go index 8730c9e99..4b110227d 100644 --- a/x/checkpointing/types/keys.go +++ b/x/checkpointing/types/keys.go @@ -1,6 +1,8 @@ package types -import sdk "github.com/cosmos/cosmos-sdk/types" +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) const ( // ModuleName defines the module name @@ -26,11 +28,9 @@ var ( BlsSigsObjectPrefix = append(BlsSigsPrefix, 0x0) // where we save the concrete bls sig bytes BlsSigsHashToEpochPrefix = append(BlsSigsPrefix, 0x1) // where we map hash to epoch - CkptsObjectPrefix = append(CheckpointsPrefix, 0x0) // where we save the concrete bls sig bytes - CkptsHashToEpochPrefix = append(CheckpointsPrefix, 0x1) // where we map hash to epoch - CkptsHashToStatusPrefix = append(CheckpointsPrefix, 0x2) // where we map hash to status - TipPrefix = append(CheckpointsPrefix, 0x3) // where we store the tip epoch - LastConfirmedPrefix = append(CheckpointsPrefix, 0x4) // where we store the last confirmed epoch + CkptsObjectPrefix = append(CheckpointsPrefix, 0x0) // where we save the concrete bls sig bytes + LastConfirmedPrefix = append(CheckpointsPrefix, 0x1) // where we store the last confirmed epoch + TipPrefix = append(CheckpointsPrefix, 0x2) // where we store the tip epoch ) // BlsSigsObjectKey defines epoch + hash @@ -44,30 +44,19 @@ func BlsSigsEpochKey(hash BlsSigHash) []byte { return append(BlsSigsHashToEpochPrefix, hash...) } -// CkptsObjectKey defines epoch + status + hash -func CkptsObjectKey(epoch uint64, status uint32, hash RawCkptHash) []byte { - ee := sdk.Uint64ToBigEndian(epoch) - epochPrefix := append(CkptsObjectPrefix, ee...) - epochStatusPrefix := append(epochPrefix, Uint32ToBitEndian(status)...) - return append(epochStatusPrefix, hash...) +// CkptsObjectKey defines epoch +func CkptsObjectKey(epoch uint64) []byte { + return append(CkptsObjectPrefix, sdk.Uint64ToBigEndian(epoch)...) } -func CkptsEpochKey(hash RawCkptHash) []byte { - return append(CkptsHashToEpochPrefix, hash...) -} - -func CkptsStatusKey(hash RawCkptHash) []byte { - return append(CkptsHashToStatusPrefix, hash...) +func LastConfirmedKey() []byte { + return LastConfirmedPrefix } func TipKey() []byte { return TipPrefix } -func LastConfirmedKey() []byte { - return LastConfirmedPrefix -} - func KeyPrefix(p string) []byte { return []byte(p) } diff --git a/x/checkpointing/types/types.go b/x/checkpointing/types/types.go index 0c9633d72..b8e53806f 100644 --- a/x/checkpointing/types/types.go +++ b/x/checkpointing/types/types.go @@ -1,18 +1,14 @@ package types +import "bytes" + type BlsSigHash []byte type RawCkptHash []byte -type CkptStatus uint32 - -const ( - // UNCHECKPOINTED indicates the checkpoint has not appeared on BTC - UNCHECKPOINTED uint32 = 0 - // CHECKPOINTED_NOT_CONFIRMED indicates the checkpoint has been checkpointed on BTC but has insufficent confirmation - CHECKPOINTED_NOT_CONFIRMED = 1 - // CONFIRMED indicates the checkpoint has sufficient confirmation depth on BTC - CONFIRMED = 2 -) - -var RAW_CKPT_STATUS = [3]uint32{UNCHECKPOINTED, CHECKPOINTED_NOT_CONFIRMED, CONFIRMED} +func (m RawCkptHash) Equals(h RawCkptHash) bool { + if bytes.Compare(m.Bytes(), h.Bytes()) == 0 { + return true + } + return false +} diff --git a/x/checkpointing/types/utils.go b/x/checkpointing/types/utils.go index 4d191118c..01099b1c5 100644 --- a/x/checkpointing/types/utils.go +++ b/x/checkpointing/types/utils.go @@ -1,16 +1,15 @@ package types import ( - "encoding/binary" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/tendermint/tendermint/crypto/tmhash" ) func (m BlsSig) Hash() BlsSigHash { fields := [][]byte{ + sdk.Uint64ToBigEndian(m.EpochNum), m.LastCommitHash, m.BlsSig, - sdk.Uint64ToBigEndian(m.EpochNum), []byte(m.SignerAddress), } return hash(fields) @@ -18,10 +17,10 @@ func (m BlsSig) Hash() BlsSigHash { func (m RawCheckpoint) Hash() RawCkptHash { fields := [][]byte{ - m.LastCommitHash, sdk.Uint64ToBigEndian(m.EpochNum), - m.Bitmap, + m.LastCommitHash, m.BlsMultiSig, + m.Bitmap, } return hash(fields) } @@ -34,20 +33,10 @@ func hash(fields [][]byte) []byte { return tmhash.Sum(bz) } -func BlsSigHashToBytes(h BlsSigHash) []byte { - return h -} - -func Uint32ToBitEndian(i uint32) []byte { - b := make([]byte, 4) - binary.BigEndian.PutUint32(b, i) - return b +func (m BlsSigHash) Bytes() []byte { + return m } -func BigEndianToUint32(bz []byte) uint32 { - if len(bz) == 0 { - return 0 - } - - return binary.BigEndian.Uint32(bz) +func (m RawCkptHash) Bytes() []byte { + return m } From 232dc9685b115da660dba5181cfeb2bf1b05838a Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Sun, 26 Jun 2022 22:53:33 +0800 Subject: [PATCH 13/16] use reverse iterator instead of storing tip epoch --- x/checkpointing/keeper/ckpt_state.go | 98 +++++++--------------------- x/checkpointing/types/keys.go | 12 +--- 2 files changed, 23 insertions(+), 87 deletions(-) diff --git a/x/checkpointing/keeper/ckpt_state.go b/x/checkpointing/keeper/ckpt_state.go index 5e29a8f02..7b6a062de 100644 --- a/x/checkpointing/keeper/ckpt_state.go +++ b/x/checkpointing/keeper/ckpt_state.go @@ -9,29 +9,23 @@ import ( ) type CheckpointsState struct { - cdc codec.BinaryCodec - checkpoints sdk.KVStore - lastConfirmedEpoch sdk.KVStore - tipEpoch sdk.KVStore + cdc codec.BinaryCodec + checkpoints sdk.KVStore } func (k Keeper) CheckpointsState(ctx sdk.Context) CheckpointsState { // Build the CheckpointsState storage store := ctx.KVStore(k.storeKey) return CheckpointsState{ - cdc: k.cdc, - checkpoints: prefix.NewStore(store, types.CheckpointsPrefix), - lastConfirmedEpoch: prefix.NewStore(store, types.CheckpointsPrefix), - tipEpoch: prefix.NewStore(store, types.CheckpointsPrefix), + cdc: k.cdc, + checkpoints: prefix.NewStore(store, types.CheckpointsPrefix), } } // CreateRawCkpt inserts the raw checkpoint into the storage by its epoch number -func (cs CheckpointsState) CreateRawCkpt(ckpt *types.RawCheckpoint) error { +func (cs CheckpointsState) CreateRawCkpt(ckpt *types.RawCheckpoint) { // save concrete ckpt object - cs.checkpoints.Set(types.CkptsObjectKey(ckpt.EpochNum), cs.cdc.MustMarshal(ckpt)) - - return cs.UpdateTipEpoch(ckpt.EpochNum) + cs.checkpoints.Set(types.CkptsObjectKey(ckpt.EpochNum), cs.SerializeCkpt(ckpt)) } // GetRawCkpt retrieves a raw checkpoint by its epoch number @@ -45,36 +39,26 @@ func (cs CheckpointsState) GetRawCkpt(epoch uint64) (*types.RawCheckpoint, error return cs.DeserializeCkpt(rawBytes), nil } -// GetRawCkptsByStatus retrieves raw checkpoints by their status by the accending order of epoch -func (cs CheckpointsState) GetRawCkptsByStatus(status types.CkptStatus) ([]*types.RawCheckpoint, error) { - var startEpoch, endEpoch uint64 - lce := cs.GetLastConfirmedEpoch() - if status == types.Confirmed { - endEpoch = cs.GetLastConfirmedEpoch() - startEpoch = 0 - } else { - startEpoch = lce + 1 - endEpoch = cs.GetTipEpoch() - } - if endEpoch <= startEpoch { - return nil, types.ErrCkptsDoNotExist.Wrap("no raw checkpoints with provided status") - } - return cs.getRawCkptsByEpochRangeWithStatus(startEpoch, endEpoch, status) -} +// GetRawCkptsByStatus retrieves raw checkpoints by their status by the descending order of epoch +func (cs CheckpointsState) GetRawCkptsByStatus(status types.CkptStatus) []*types.RawCheckpoint { + var ckpts []*types.RawCheckpoint + + store := prefix.NewStore(cs.checkpoints, types.CkptsObjectPrefix) + iter := store.ReverseIterator(nil, nil) + defer iter.Close() -func (cs CheckpointsState) getRawCkptsByEpochRangeWithStatus(start uint64, endEpoch uint64, status types.CkptStatus) ([]*types.RawCheckpoint, error) { - ckptList := make([]*types.RawCheckpoint, endEpoch-start) - for i := start; i <= endEpoch; i++ { - ckpt, err := cs.GetRawCkpt(i) - if err != nil { - return nil, err + for ; iter.Valid(); iter.Next() { + ckptBytes := iter.Value() + ckpt := cs.DeserializeCkpt(ckptBytes) + // the loop can end if the current status is CONFIRMED but the requested status is not CONFIRMED + if status != types.Confirmed && ckpt.Status == types.Confirmed { + return ckpts } - if status == ckpt.Status { - ckptList = append(ckptList, ckpt) + if ckpt.Status == status { + ckpts = append(ckpts, ckpt) } } - - return ckptList, nil + return ckpts } // UpdateCkptStatus updates the checkpoint's status @@ -94,44 +78,6 @@ func (cs CheckpointsState) UpdateCkptStatus(rawCkptBytes []byte, status types.Ck return nil } -// GetLastConfirmedEpoch retrieves the last confirmed epoch -func (cs CheckpointsState) GetLastConfirmedEpoch() uint64 { - if !cs.lastConfirmedEpoch.Has(types.LastConfirmedKey()) { - return 0 - } - bz := cs.lastConfirmedEpoch.Get(types.LastConfirmedKey()) - return sdk.BigEndianToUint64(bz) -} - -func (cs CheckpointsState) UpdateLastConfirmedEpoch(epoch uint64) error { - e := cs.GetLastConfirmedEpoch() - if e >= epoch { - return errors.New("failed to update last confirmed epoch") - } - epochKey := types.LastConfirmedKey() - cs.lastConfirmedEpoch.Set(epochKey, sdk.Uint64ToBigEndian(epoch)) - return nil -} - -// GetTipEpoch returns the highest epoch that has created a raw checkpoint -func (cs CheckpointsState) GetTipEpoch() uint64 { - if !cs.tipEpoch.Has(types.TipKey()) { - return 0 - } - bz := cs.tipEpoch.Get(types.TipKey()) - return sdk.BigEndianToUint64(bz) -} - -func (cs CheckpointsState) UpdateTipEpoch(epoch uint64) error { - tipKey := types.TipKey() - te := sdk.BigEndianToUint64(cs.tipEpoch.Get(tipKey)) - if te >= epoch { - return errors.New("failed to update tip epoch") - } - cs.tipEpoch.Set(tipKey, sdk.Uint64ToBigEndian(epoch)) - return nil -} - func (cs CheckpointsState) DeserializeCkpt(rawCkptBytes []byte) *types.RawCheckpoint { ckpt := new(types.RawCheckpoint) cs.cdc.MustUnmarshal(rawCkptBytes, ckpt) diff --git a/x/checkpointing/types/keys.go b/x/checkpointing/types/keys.go index 4b110227d..7ffd74232 100644 --- a/x/checkpointing/types/keys.go +++ b/x/checkpointing/types/keys.go @@ -28,9 +28,7 @@ var ( BlsSigsObjectPrefix = append(BlsSigsPrefix, 0x0) // where we save the concrete bls sig bytes BlsSigsHashToEpochPrefix = append(BlsSigsPrefix, 0x1) // where we map hash to epoch - CkptsObjectPrefix = append(CheckpointsPrefix, 0x0) // where we save the concrete bls sig bytes - LastConfirmedPrefix = append(CheckpointsPrefix, 0x1) // where we store the last confirmed epoch - TipPrefix = append(CheckpointsPrefix, 0x2) // where we store the tip epoch + CkptsObjectPrefix = append(CheckpointsPrefix, 0x0) // where we save the concrete bls sig bytes ) // BlsSigsObjectKey defines epoch + hash @@ -49,14 +47,6 @@ func CkptsObjectKey(epoch uint64) []byte { return append(CkptsObjectPrefix, sdk.Uint64ToBigEndian(epoch)...) } -func LastConfirmedKey() []byte { - return LastConfirmedPrefix -} - -func TipKey() []byte { - return TipPrefix -} - func KeyPrefix(p string) []byte { return []byte(p) } From f50e4935158d900a32f5bd1916e8a7e2bf1fb87f Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Tue, 28 Jun 2022 17:00:25 +0800 Subject: [PATCH 14/16] fixed serizalizer and deserializer --- proto/babylon/checkpointing/checkpoint.proto | 32 +- proto/babylon/checkpointing/query.proto | 2 +- x/checkpointing/keeper/blssig_state.go | 19 +- x/checkpointing/keeper/ckpt_state.go | 63 ++-- x/checkpointing/keeper/keeper.go | 19 +- x/checkpointing/types/blssig_set.go | 5 - x/checkpointing/types/checkpoint.pb.go | 293 +++++++++++++++---- x/checkpointing/types/query.pb.go | 118 ++++---- x/checkpointing/types/query.pb.gw.go | 10 +- x/checkpointing/types/types.go | 42 ++- 10 files changed, 414 insertions(+), 189 deletions(-) diff --git a/proto/babylon/checkpointing/checkpoint.proto b/proto/babylon/checkpointing/checkpoint.proto index 35cea0328..3aa28b03d 100644 --- a/proto/babylon/checkpointing/checkpoint.proto +++ b/proto/babylon/checkpointing/checkpoint.proto @@ -7,7 +7,7 @@ import "google/protobuf/timestamp.proto"; option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; -// RawCheckpoint wraps the multi sig with meta data. +// RawCheckpoint wraps the bls multi sig with meta data message RawCheckpoint { option (gogoproto.equal) = true; @@ -19,8 +19,25 @@ message RawCheckpoint { bytes bitmap = 3; // bls_multi_sig defines the multi sig that is aggregated from individual bls sigs bytes bls_multi_sig = 4; +} + +// RawCheckpointWithMeta wraps the raw checkpoint with meta data. +message RawCheckpointWithMeta { + RawCheckpoint ckpt = 1; // status defines the status of the checkpoint - CkptStatus status = 5; + CheckpointStatus status = 2; +} + +// CkptStatus is the status of a checkpoint. +enum CheckpointStatus{ + option (gogoproto.goproto_enum_prefix) = false; + + // UNCHECKPOINTED defines a checkpoint that is checkpointed on BTC. + CKPT_STATUS_UNCHECKPOINTED = 0 [(gogoproto.enumvalue_customname) = "Uncheckpointed"]; + // UNCONFIRMED defines a validator that is checkpointed on BTC but not confirmed. + CKPT_STATUS_UNCONFIRMED = 1 [(gogoproto.enumvalue_customname) = "Unconfirmed"]; + // CONFIRMED defines a validator that is confirmed on BTC. + CKPT_STATUS_CONFIRMED = 2 [(gogoproto.enumvalue_customname) = "Confirmed"]; } // BlsSig wraps the bls sig with meta data. @@ -37,14 +54,3 @@ message BlsSig { string signer_address = 5; } -// CkptStatus is the status of a checkpoint. -enum CkptStatus{ - option (gogoproto.goproto_enum_prefix) = false; - - // UNCHECKPOINTED defines a checkpoint that is checkpointed on BTC. - CKPT_STATUS_UNCHECKPOINTED = 0 [(gogoproto.enumvalue_customname) = "Uncheckpointed"]; - // UNCONFIRMED defines a validator that is checkpointed on BTC but not confirmed. - CKPT_STATUS_UNCONFIRMED = 1 [(gogoproto.enumvalue_customname) = "Unconfirmed"]; - // CONFIRMED defines a validator that is confirmed on BTC. - CKPT_STATUS_CONFIRMED = 2 [(gogoproto.enumvalue_customname) = "Confirmed"]; -} diff --git a/proto/babylon/checkpointing/query.proto b/proto/babylon/checkpointing/query.proto index 80a84ffca..95e623883 100644 --- a/proto/babylon/checkpointing/query.proto +++ b/proto/babylon/checkpointing/query.proto @@ -45,7 +45,7 @@ service Query { // RPC method. message QueryRawCheckpointListRequest { // status defines the status of the raw checkpoints of the query - uint32 status = 1; + CheckpointStatus status = 1; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; diff --git a/x/checkpointing/keeper/blssig_state.go b/x/checkpointing/keeper/blssig_state.go index a75c5feb8..be76da30a 100644 --- a/x/checkpointing/keeper/blssig_state.go +++ b/x/checkpointing/keeper/blssig_state.go @@ -31,7 +31,7 @@ func (bs BlsSigsState) CreateBlsSig(sig *types.BlsSig) { epochKey := types.BlsSigsEpochKey(sigHash) // save concrete bls sig object - bs.blsSigs.Set(blsSigsKey, bs.SerializeBlsSig(sig)) + bs.blsSigs.Set(blsSigsKey, types.BlsSigToBytes(bs.cdc, sig)) // map bls sig to epoch bs.hashToEpoch.Set(epochKey, sdk.Uint64ToBigEndian(epoch)) } @@ -44,10 +44,13 @@ func (bs BlsSigsState) GetBlsSigsByEpoch(epoch uint64, f func(sig *types.BlsSig) for ; iter.Valid(); iter.Next() { rawBytes := iter.Value() - blsSig := bs.DeserializeBlsSig(rawBytes) + blsSig, err := types.BytesToBlsSig(bs.cdc, rawBytes) + if err != nil { + return err + } stop := f(blsSig) if stop { - break + return nil } } return nil @@ -58,13 +61,3 @@ func (bs BlsSigsState) Exists(hash types.BlsSigHash) bool { store := prefix.NewStore(bs.hashToEpoch, types.BlsSigsHashToEpochPrefix) return store.Has(hash.Bytes()) } - -func (bs BlsSigsState) SerializeBlsSig(sig *types.BlsSig) []byte { - return bs.cdc.MustMarshal(sig) -} - -func (bs BlsSigsState) DeserializeBlsSig(rawSigBytes []byte) *types.BlsSig { - sig := new(types.BlsSig) - bs.cdc.MustUnmarshal(rawSigBytes, sig) - return sig -} diff --git a/x/checkpointing/keeper/ckpt_state.go b/x/checkpointing/keeper/ckpt_state.go index 7b6a062de..9203e3b3d 100644 --- a/x/checkpointing/keeper/ckpt_state.go +++ b/x/checkpointing/keeper/ckpt_state.go @@ -22,68 +22,67 @@ func (k Keeper) CheckpointsState(ctx sdk.Context) CheckpointsState { } } -// CreateRawCkpt inserts the raw checkpoint into the storage by its epoch number -func (cs CheckpointsState) CreateRawCkpt(ckpt *types.RawCheckpoint) { +// CreateRawCkptWithMeta inserts the raw checkpoint with meta into the storage by its epoch number +// a new checkpoint is created with the status of UNCEHCKPOINTED +func (cs CheckpointsState) CreateRawCkptWithMeta(ckpt *types.RawCheckpoint) { // save concrete ckpt object - cs.checkpoints.Set(types.CkptsObjectKey(ckpt.EpochNum), cs.SerializeCkpt(ckpt)) + ckptWithMeta := types.NewCheckpointWithMeta(ckpt, types.Uncheckpointed) + cs.checkpoints.Set(types.CkptsObjectKey(ckpt.EpochNum), types.CkptWithMetaToBytes(cs.cdc, ckptWithMeta)) } -// GetRawCkpt retrieves a raw checkpoint by its epoch number -func (cs CheckpointsState) GetRawCkpt(epoch uint64) (*types.RawCheckpoint, error) { +// GetRawCkptWithMeta retrieves a raw checkpoint with meta by its epoch number +func (cs CheckpointsState) GetRawCkptWithMeta(epoch uint64) (*types.RawCheckpointWithMeta, error) { ckptsKey := types.CkptsObjectKey(epoch) rawBytes := cs.checkpoints.Get(ckptsKey) if rawBytes == nil { return nil, types.ErrCkptDoesNotExist.Wrap("no raw checkpoint with provided epoch") } - return cs.DeserializeCkpt(rawBytes), nil + return types.BytesToCkptWithMeta(cs.cdc, rawBytes) } -// GetRawCkptsByStatus retrieves raw checkpoints by their status by the descending order of epoch -func (cs CheckpointsState) GetRawCkptsByStatus(status types.CkptStatus) []*types.RawCheckpoint { - var ckpts []*types.RawCheckpoint - +// GetRawCkptsWithMetaByStatus retrieves raw checkpoints with meta by their status by the descending order of epoch +func (cs CheckpointsState) GetRawCkptsWithMetaByStatus(status types.CheckpointStatus, f func(sig *types.RawCheckpointWithMeta) bool) error { store := prefix.NewStore(cs.checkpoints, types.CkptsObjectPrefix) iter := store.ReverseIterator(nil, nil) defer iter.Close() + // the iterator starts from the highest epoch number + // once it gets to an epoch where the status is CONFIRMED, + // all the lower epochs will be CONFIRMED for ; iter.Valid(); iter.Next() { ckptBytes := iter.Value() - ckpt := cs.DeserializeCkpt(ckptBytes) + ckptWithMeta, err := types.BytesToCkptWithMeta(cs.cdc, ckptBytes) + if err != nil { + return err + } // the loop can end if the current status is CONFIRMED but the requested status is not CONFIRMED - if status != types.Confirmed && ckpt.Status == types.Confirmed { - return ckpts + if status != types.Confirmed && ckptWithMeta.Status == types.Confirmed { + return nil } - if ckpt.Status == status { - ckpts = append(ckpts, ckpt) + if ckptWithMeta.Status != status { + continue + } + stop := f(ckptWithMeta) + if stop { + return nil } } - return ckpts + return nil } // UpdateCkptStatus updates the checkpoint's status -func (cs CheckpointsState) UpdateCkptStatus(rawCkptBytes []byte, status types.CkptStatus) error { - ckpt := cs.DeserializeCkpt(rawCkptBytes) - c, err := cs.GetRawCkpt(ckpt.EpochNum) +func (cs CheckpointsState) UpdateCkptStatus(ckpt *types.RawCheckpoint, status types.CheckpointStatus) error { + ckptWithMeta, err := cs.GetRawCkptWithMeta(ckpt.EpochNum) if err != nil { // the checkpoint should exist return err } - if !c.Hash().Equals(ckpt.Hash()) { + if !ckptWithMeta.Ckpt.Hash().Equals(ckpt.Hash()) { return errors.New("hash not the same with existing checkpoint") } - ckpt.Status = status - cs.checkpoints.Set(sdk.Uint64ToBigEndian(ckpt.EpochNum), cs.cdc.MustMarshal(ckpt)) + ckptWithMeta.Status = status + cs.checkpoints.Set(sdk.Uint64ToBigEndian(ckpt.EpochNum), types.CkptWithMetaToBytes(cs.cdc, ckptWithMeta)) return nil } - -func (cs CheckpointsState) DeserializeCkpt(rawCkptBytes []byte) *types.RawCheckpoint { - ckpt := new(types.RawCheckpoint) - cs.cdc.MustUnmarshal(rawCkptBytes, ckpt) - return ckpt -} - -func (cs CheckpointsState) SerializeCkpt(ckpt *types.RawCheckpoint) []byte { - return cs.cdc.MustMarshal(ckpt) -} diff --git a/x/checkpointing/keeper/keeper.go b/x/checkpointing/keeper/keeper.go index 4fcd531f1..fa9598d91 100644 --- a/x/checkpointing/keeper/keeper.go +++ b/x/checkpointing/keeper/keeper.go @@ -60,15 +60,18 @@ func (k Keeper) AddBlsSig(ctx sdk.Context, sig *types.BlsSig) error { // AddRawCheckpoint adds a raw checkpoint into the storage // this API may not needed since checkpoints are generated internally -func (k Keeper) AddRawCheckpoint(ctx sdk.Context, ckpt *types.RawCheckpoint) error { +func (k Keeper) AddRawCheckpoint(ctx sdk.Context, ckpt *types.RawCheckpoint) { // NOTE: may remove this API - return k.CheckpointsState(ctx).CreateRawCkpt(ckpt) + k.CheckpointsState(ctx).CreateRawCkptWithMeta(ckpt) } // CheckpointEpoch verifies checkpoint from BTC and returns epoch number func (k Keeper) CheckpointEpoch(ctx sdk.Context, rawCkptBytes []byte) (uint64, error) { - ckpt := k.CheckpointsState(ctx).DeserializeCkpt(rawCkptBytes) - err := k.verifyRawCheckpoint(ckpt) + ckpt, err := types.BytesToRawCkpt(k.cdc, rawCkptBytes) + if err != nil { + return 0, err + } + err = k.verifyRawCheckpoint(ckpt) if err != nil { return 0, err } @@ -81,7 +84,11 @@ func (k Keeper) verifyRawCheckpoint(ckpt *types.RawCheckpoint) error { } // UpdateCkptStatus updates the status of a raw checkpoint -func (k Keeper) UpdateCkptStatus(ctx sdk.Context, rawCkptBytes []byte, status types.CkptStatus) error { +func (k Keeper) UpdateCkptStatus(ctx sdk.Context, rawCkptBytes []byte, status types.CheckpointStatus) error { // TODO: some checks - return k.CheckpointsState(ctx).UpdateCkptStatus(rawCkptBytes, status) + ckpt, err := types.BytesToRawCkpt(k.cdc, rawCkptBytes) + if err != nil { + return err + } + return k.CheckpointsState(ctx).UpdateCkptStatus(ckpt, status) } diff --git a/x/checkpointing/types/blssig_set.go b/x/checkpointing/types/blssig_set.go index beee31b04..5a0a982e7 100644 --- a/x/checkpointing/types/blssig_set.go +++ b/x/checkpointing/types/blssig_set.go @@ -12,7 +12,6 @@ type BlsSigSet struct { validators types.Validators sum uint64 - sigsBySigner map[string]*BlsSig sigsBitArray *bits.BitArray } @@ -23,15 +22,11 @@ func NewBlsSigSet(epoch uint16, lastCommitHash bytes.HexBytes, validators types. lastCommitHash: lastCommitHash, validators: validators, sum: 0, - sigsBySigner: make(map[string]*BlsSig, validators.Len()), sigsBitArray: bits.NewBitArray(validators.Len()), } } func (bs *BlsSigSet) AddBlsSig(sig *BlsSig) (bool, error) { - if bs == nil { - panic("AddVote() on nil BlsSigSet") - } return bs.addBlsSig(sig) } diff --git a/x/checkpointing/types/checkpoint.pb.go b/x/checkpointing/types/checkpoint.pb.go index ed8d414ce..1d860a278 100644 --- a/x/checkpointing/types/checkpoint.pb.go +++ b/x/checkpointing/types/checkpoint.pb.go @@ -27,38 +27,38 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // CkptStatus is the status of a checkpoint. -type CkptStatus int32 +type CheckpointStatus int32 const ( // UNCHECKPOINTED defines a checkpoint that is checkpointed on BTC. - Uncheckpointed CkptStatus = 0 + Uncheckpointed CheckpointStatus = 0 // UNCONFIRMED defines a validator that is checkpointed on BTC but not confirmed. - Unconfirmed CkptStatus = 1 + Unconfirmed CheckpointStatus = 1 // CONFIRMED defines a validator that is confirmed on BTC. - Confirmed CkptStatus = 2 + Confirmed CheckpointStatus = 2 ) -var CkptStatus_name = map[int32]string{ +var CheckpointStatus_name = map[int32]string{ 0: "CKPT_STATUS_UNCHECKPOINTED", 1: "CKPT_STATUS_UNCONFIRMED", 2: "CKPT_STATUS_CONFIRMED", } -var CkptStatus_value = map[string]int32{ +var CheckpointStatus_value = map[string]int32{ "CKPT_STATUS_UNCHECKPOINTED": 0, "CKPT_STATUS_UNCONFIRMED": 1, "CKPT_STATUS_CONFIRMED": 2, } -func (x CkptStatus) String() string { - return proto.EnumName(CkptStatus_name, int32(x)) +func (x CheckpointStatus) String() string { + return proto.EnumName(CheckpointStatus_name, int32(x)) } -func (CkptStatus) EnumDescriptor() ([]byte, []int) { +func (CheckpointStatus) EnumDescriptor() ([]byte, []int) { return fileDescriptor_63ff05f0a47b36f7, []int{0} } -// RawCheckpoint wraps the multi sig with meta data. +// RawCheckpoint wraps the bls multi sig with meta data type RawCheckpoint struct { // epoch_num defines the epoch number the raw checkpoint is for EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` @@ -68,8 +68,6 @@ type RawCheckpoint struct { Bitmap []byte `protobuf:"bytes,3,opt,name=bitmap,proto3" json:"bitmap,omitempty"` // bls_multi_sig defines the multi sig that is aggregated from individual bls sigs BlsMultiSig []byte `protobuf:"bytes,4,opt,name=bls_multi_sig,json=blsMultiSig,proto3" json:"bls_multi_sig,omitempty"` - // status defines the status of the checkpoint - Status CkptStatus `protobuf:"varint,5,opt,name=status,proto3,enum=babylon.checkpointing.v1.CkptStatus" json:"status,omitempty"` } func (m *RawCheckpoint) Reset() { *m = RawCheckpoint{} } @@ -133,7 +131,54 @@ func (m *RawCheckpoint) GetBlsMultiSig() []byte { return nil } -func (m *RawCheckpoint) GetStatus() CkptStatus { +// RawCheckpointWithMeta wraps the raw checkpoint with meta data. +type RawCheckpointWithMeta struct { + Ckpt *RawCheckpoint `protobuf:"bytes,1,opt,name=ckpt,proto3" json:"ckpt,omitempty"` + // status defines the status of the checkpoint + Status CheckpointStatus `protobuf:"varint,2,opt,name=status,proto3,enum=babylon.checkpointing.v1.CheckpointStatus" json:"status,omitempty"` +} + +func (m *RawCheckpointWithMeta) Reset() { *m = RawCheckpointWithMeta{} } +func (m *RawCheckpointWithMeta) String() string { return proto.CompactTextString(m) } +func (*RawCheckpointWithMeta) ProtoMessage() {} +func (*RawCheckpointWithMeta) Descriptor() ([]byte, []int) { + return fileDescriptor_63ff05f0a47b36f7, []int{1} +} +func (m *RawCheckpointWithMeta) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RawCheckpointWithMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RawCheckpointWithMeta.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 *RawCheckpointWithMeta) XXX_Merge(src proto.Message) { + xxx_messageInfo_RawCheckpointWithMeta.Merge(m, src) +} +func (m *RawCheckpointWithMeta) XXX_Size() int { + return m.Size() +} +func (m *RawCheckpointWithMeta) XXX_DiscardUnknown() { + xxx_messageInfo_RawCheckpointWithMeta.DiscardUnknown(m) +} + +var xxx_messageInfo_RawCheckpointWithMeta proto.InternalMessageInfo + +func (m *RawCheckpointWithMeta) GetCkpt() *RawCheckpoint { + if m != nil { + return m.Ckpt + } + return nil +} + +func (m *RawCheckpointWithMeta) GetStatus() CheckpointStatus { if m != nil { return m.Status } @@ -158,7 +203,7 @@ func (m *BlsSig) Reset() { *m = BlsSig{} } func (m *BlsSig) String() string { return proto.CompactTextString(m) } func (*BlsSig) ProtoMessage() {} func (*BlsSig) Descriptor() ([]byte, []int) { - return fileDescriptor_63ff05f0a47b36f7, []int{1} + return fileDescriptor_63ff05f0a47b36f7, []int{2} } func (m *BlsSig) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -216,8 +261,9 @@ func (m *BlsSig) GetSignerAddress() string { } func init() { - proto.RegisterEnum("babylon.checkpointing.v1.CkptStatus", CkptStatus_name, CkptStatus_value) + proto.RegisterEnum("babylon.checkpointing.v1.CheckpointStatus", CheckpointStatus_name, CheckpointStatus_value) proto.RegisterType((*RawCheckpoint)(nil), "babylon.checkpointing.v1.RawCheckpoint") + proto.RegisterType((*RawCheckpointWithMeta)(nil), "babylon.checkpointing.v1.RawCheckpointWithMeta") proto.RegisterType((*BlsSig)(nil), "babylon.checkpointing.v1.BlsSig") } @@ -226,38 +272,40 @@ func init() { } var fileDescriptor_63ff05f0a47b36f7 = []byte{ - // 487 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0x4f, 0x6f, 0xd3, 0x30, - 0x18, 0x87, 0xeb, 0x51, 0x0a, 0xf5, 0x68, 0xa9, 0x2c, 0x60, 0x21, 0x48, 0x59, 0x54, 0x01, 0x8a, - 0x10, 0x4a, 0xc4, 0x10, 0x17, 0xc4, 0x65, 0xcb, 0x8a, 0x36, 0x4d, 0x6b, 0xa7, 0xb4, 0xbd, 0x70, - 0x89, 0x9c, 0x34, 0x73, 0xac, 0xc5, 0x76, 0x54, 0x3b, 0xc0, 0xbe, 0x01, 0xea, 0x05, 0xbe, 0x40, - 0x11, 0x12, 0x5f, 0x86, 0xe3, 0x4e, 0x88, 0x23, 0x6a, 0x2f, 0x7c, 0x0c, 0x94, 0x3f, 0xa5, 0x63, - 0x12, 0x37, 0x6e, 0xf9, 0x3d, 0x7e, 0x5e, 0xe7, 0x7d, 0x93, 0x17, 0x3e, 0x0e, 0x70, 0x70, 0x9e, - 0x08, 0xee, 0x84, 0x71, 0x14, 0x9e, 0xa5, 0x82, 0x72, 0x45, 0x39, 0xb9, 0x94, 0xec, 0x74, 0x2a, - 0x94, 0x40, 0x5a, 0xe5, 0xd9, 0x7f, 0x79, 0xf6, 0xdb, 0x67, 0xfa, 0xfd, 0x50, 0x48, 0x26, 0xa4, - 0x5f, 0x78, 0x4e, 0x19, 0xca, 0x22, 0xfd, 0x0e, 0x11, 0x44, 0x94, 0x3c, 0x7f, 0xaa, 0xe8, 0x36, - 0x11, 0x82, 0x24, 0x91, 0x53, 0xa4, 0x20, 0x3b, 0x75, 0x14, 0x65, 0x91, 0x54, 0x98, 0xa5, 0xa5, - 0xd0, 0xfd, 0x0e, 0x60, 0xcb, 0xc3, 0xef, 0xdc, 0x3f, 0x6f, 0x42, 0x0f, 0x60, 0x33, 0x4a, 0x45, - 0x18, 0xfb, 0x3c, 0x63, 0x1a, 0x30, 0x81, 0x55, 0xf7, 0x6e, 0x16, 0xa0, 0x9f, 0x31, 0x64, 0xc1, - 0x4e, 0x82, 0xa5, 0xf2, 0x43, 0xc1, 0x18, 0x55, 0x7e, 0x8c, 0x65, 0xac, 0x6d, 0x98, 0xc0, 0xba, - 0xe5, 0xb5, 0x73, 0xee, 0x16, 0xf8, 0x00, 0xcb, 0x18, 0xdd, 0x83, 0x8d, 0x80, 0x2a, 0x86, 0x53, - 0xed, 0x5a, 0x71, 0x5e, 0x25, 0xd4, 0x85, 0xad, 0x20, 0x91, 0x3e, 0xcb, 0x12, 0x45, 0x7d, 0x49, - 0x89, 0x56, 0x2f, 0x8e, 0x37, 0x83, 0x44, 0x1e, 0xe7, 0x6c, 0x48, 0x09, 0x7a, 0x05, 0x1b, 0x52, - 0x61, 0x95, 0x49, 0xed, 0xba, 0x09, 0xac, 0xf6, 0xce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 0xa8, 0x8a, 0xb3, - 0xc0, 0x0e, 0x05, 0x73, 0xaa, 0x5f, 0x11, 0xc6, 0x98, 0xf2, 0x55, 0x70, 0xde, 0x5f, 0xd9, 0x69, - 0x75, 0x9e, 0x46, 0x32, 0x68, 0x14, 0x3b, 0xf6, 0xfc, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1a, - 0xcb, 0x8e, 0xe0, 0xf9, 0x02, 0x00, 0x00, + // 517 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0x41, 0x6f, 0xd3, 0x3e, + 0x1c, 0xad, 0xf7, 0xef, 0xbf, 0x50, 0x97, 0x96, 0xca, 0x62, 0x2c, 0x04, 0x29, 0x8b, 0x2a, 0x01, + 0xd5, 0x84, 0x12, 0x51, 0xc4, 0x05, 0x4e, 0x6b, 0x56, 0xb4, 0x69, 0x6a, 0x3b, 0xa5, 0xad, 0x90, + 0xb8, 0x44, 0x4e, 0x9a, 0x25, 0xd6, 0xe2, 0x38, 0xaa, 0x1d, 0x60, 0xdf, 0x00, 0xf5, 0x02, 0x47, + 0x2e, 0x95, 0x90, 0xe0, 0xc3, 0x70, 0xdc, 0x91, 0x23, 0x6a, 0x2f, 0x7c, 0x0c, 0x14, 0xa7, 0xa5, + 0x6b, 0xa5, 0xdd, 0xb8, 0xe5, 0xbd, 0xdf, 0x7b, 0xf1, 0xf3, 0xb3, 0x0d, 0x1f, 0xbb, 0xd8, 0xbd, + 0x8c, 0x58, 0x6c, 0x7a, 0xa1, 0xef, 0x5d, 0x24, 0x8c, 0xc4, 0x82, 0xc4, 0xc1, 0x35, 0x64, 0x24, + 0x13, 0x26, 0x18, 0x52, 0x96, 0x3a, 0x63, 0x43, 0x67, 0xbc, 0x7b, 0xa6, 0x3e, 0xf0, 0x18, 0xa7, + 0x8c, 0x3b, 0x52, 0x67, 0xe6, 0x20, 0x37, 0xa9, 0xf7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, 0xe3, 0xe7, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x99, 0x75, 0xc9, + 0xc2, 0x5c, 0x03, 0x00, 0x00, } func (this *RawCheckpoint) Equal(that interface{}) bool { @@ -291,9 +339,6 @@ func (this *RawCheckpoint) Equal(that interface{}) bool { if !bytes.Equal(this.BlsMultiSig, that1.BlsMultiSig) { return false } - if this.Status != that1.Status { - return false - } return true } func (m *RawCheckpoint) Marshal() (dAtA []byte, err error) { @@ -316,11 +361,6 @@ func (m *RawCheckpoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Status != 0 { - i = encodeVarintCheckpoint(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x28 - } if len(m.BlsMultiSig) > 0 { i -= len(m.BlsMultiSig) copy(dAtA[i:], m.BlsMultiSig) @@ -350,6 +390,46 @@ func (m *RawCheckpoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *RawCheckpointWithMeta) 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 *RawCheckpointWithMeta) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RawCheckpointWithMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Status != 0 { + i = encodeVarintCheckpoint(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x10 + } + if m.Ckpt != nil { + { + size, err := m.Ckpt.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCheckpoint(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *BlsSig) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -431,6 +511,19 @@ func (m *RawCheckpoint) Size() (n int) { if l > 0 { n += 1 + l + sovCheckpoint(uint64(l)) } + return n +} + +func (m *RawCheckpointWithMeta) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Ckpt != nil { + l = m.Ckpt.Size() + n += 1 + l + sovCheckpoint(uint64(l)) + } if m.Status != 0 { n += 1 + sovCheckpoint(uint64(m.Status)) } @@ -617,7 +710,93 @@ func (m *RawCheckpoint) Unmarshal(dAtA []byte) error { m.BlsMultiSig = []byte{} } iNdEx = postIndex - case 5: + default: + iNdEx = preIndex + skippy, err := skipCheckpoint(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCheckpoint + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RawCheckpointWithMeta) 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 ErrIntOverflowCheckpoint + } + 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: RawCheckpointWithMeta: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RawCheckpointWithMeta: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ckpt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCheckpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCheckpoint + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCheckpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Ckpt == nil { + m.Ckpt = &RawCheckpoint{} + } + if err := m.Ckpt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } @@ -631,7 +810,7 @@ func (m *RawCheckpoint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Status |= CkptStatus(b&0x7F) << shift + m.Status |= CheckpointStatus(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/checkpointing/types/query.pb.go b/x/checkpointing/types/query.pb.go index 4a1e9abf8..449f522f9 100644 --- a/x/checkpointing/types/query.pb.go +++ b/x/checkpointing/types/query.pb.go @@ -34,7 +34,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // RPC method. type QueryRawCheckpointListRequest struct { // status defines the status of the raw checkpoints of the query - Status uint32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"` + Status CheckpointStatus `protobuf:"varint,1,opt,name=status,proto3,enum=babylon.checkpointing.v1.CheckpointStatus" json:"status,omitempty"` // pagination defines an optional pagination for the request. Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -72,11 +72,11 @@ func (m *QueryRawCheckpointListRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryRawCheckpointListRequest proto.InternalMessageInfo -func (m *QueryRawCheckpointListRequest) GetStatus() uint32 { +func (m *QueryRawCheckpointListRequest) GetStatus() CheckpointStatus { if m != nil { return m.Status } - return 0 + return Uncheckpointed } func (m *QueryRawCheckpointListRequest) GetPagination() *query.PageRequest { @@ -697,61 +697,61 @@ func init() { func init() { proto.RegisterFile("babylon/checkpointing/query.proto", fileDescriptor_a0fdb8f0f85bb51e) } var fileDescriptor_a0fdb8f0f85bb51e = []byte{ - // 852 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x96, 0xdd, 0x6e, 0xf3, 0x34, - 0x1c, 0xc6, 0x9b, 0x97, 0x97, 0x6a, 0xf3, 0x3e, 0xe8, 0xbc, 0x89, 0x8d, 0x32, 0x42, 0x09, 0xd3, - 0x56, 0x31, 0x96, 0xa8, 0xdd, 0xa7, 0x10, 0x9b, 0xb4, 0x4e, 0x80, 0xd0, 0xa6, 0x51, 0x22, 0x3e, - 0x24, 0x4e, 0x2a, 0x27, 0x35, 0x69, 0xb4, 0x34, 0xce, 0x62, 0xa7, 0xa3, 0x9a, 0x26, 0x24, 0xb8, - 0x00, 0x90, 0x76, 0x33, 0x48, 0x1c, 0xc1, 0xd1, 0x8e, 0xd0, 0x24, 0x4e, 0x38, 0x42, 0x68, 0xe5, - 0x3e, 0x40, 0x71, 0xdc, 0x75, 0x69, 0x9a, 0x76, 0x85, 0x1d, 0xbc, 0x67, 0x8d, 0xed, 0xff, 0x3f, - 0xbf, 0xe7, 0xb1, 0xf3, 0xb8, 0xe0, 0x2d, 0x03, 0x19, 0x6d, 0x87, 0xb8, 0x9a, 0xd9, 0xc0, 0xe6, - 0x99, 0x47, 0x6c, 0x97, 0xd9, 0xae, 0xa5, 0x9d, 0x07, 0xd8, 0x6f, 0xab, 0x9e, 0x4f, 0x18, 0x81, - 0x4b, 0x62, 0x89, 0x1a, 0x5b, 0xa2, 0xb6, 0x4a, 0xf9, 0x77, 0x4c, 0x42, 0x9b, 0x84, 0x6a, 0x06, - 0xa2, 0x38, 0x2a, 0xd1, 0x5a, 0x25, 0x03, 0x33, 0x54, 0xd2, 0x3c, 0x64, 0xd9, 0x2e, 0x62, 0x36, - 0x71, 0xa3, 0x2e, 0xf9, 0x05, 0x8b, 0x58, 0x84, 0xff, 0xd4, 0xc2,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x6b, 0xd8, 0x80, - 0xeb, 0xe9, 0x1a, 0x12, 0x99, 0x1c, 0x7e, 0x20, 0xb9, 0xfe, 0x1c, 0x1b, 0x89, 0x9e, 0x12, 0xbf, - 0x23, 0xd1, 0xd3, 0x02, 0x53, 0xd9, 0xe7, 0xe8, 0xbb, 0x70, 0x3b, 0x1d, 0x5d, 0x7c, 0xf0, 0x8e, - 0x6d, 0xf2, 0x20, 0x8d, 0xf9, 0xff, 0x83, 0x04, 0xb2, 0x51, 0xd8, 0xc0, 0x77, 0x47, 0x20, 0xc4, - 0x32, 0x2e, 0xbf, 0xf1, 0xc8, 0xd5, 0x02, 0xb3, 0xc8, 0x31, 0x15, 0x58, 0x48, 0xc7, 0x8c, 0x52, - 0xae, 0xf2, 0xc9, 0xcd, 0x9d, 0x2c, 0xdd, 0xde, 0xc9, 0xd2, 0x5f, 0x77, 0xb2, 0xf4, 0x63, 0x47, - 0xce, 0xdc, 0x76, 0xe4, 0xcc, 0x1f, 0x1d, 0x39, 0xf3, 0xd5, 0xb6, 0x65, 0xb3, 0x46, 0x60, 0xa8, - 0x26, 0x69, 0x76, 0xbb, 0x98, 0x0d, 0x64, 0xbb, 0xf7, 0x2d, 0xbf, 0xe9, 0x6b, 0xca, 0xda, 0x1e, - 0xa6, 0x46, 0x96, 0xff, 0xb3, 0xdd, 0xfc, 0x37, 0x00, 0x00, 0xff, 0xff, 0x7c, 0xa2, 0xc8, 0x63, - 0xc4, 0x0b, 0x00, 0x00, + // 864 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x96, 0x4d, 0x6f, 0xe3, 0x44, + 0x1c, 0xc6, 0xe3, 0x65, 0x89, 0xb6, 0xd3, 0xdd, 0x90, 0xce, 0x56, 0xda, 0x12, 0x16, 0x13, 0xcc, + 0xaa, 0x8d, 0x5a, 0x6a, 0x2b, 0xe9, 0xab, 0x10, 0xad, 0xd4, 0x54, 0x80, 0x50, 0xab, 0x12, 0xcc, + 0x9b, 0xc4, 0x25, 0x1a, 0x3b, 0x83, 0x63, 0xd5, 0xf1, 0xb8, 0x9e, 0x71, 0x4a, 0x54, 0xf5, 0x02, + 0x1f, 0x00, 0xa4, 0x7e, 0x0c, 0xbe, 0x00, 0x12, 0x27, 0x38, 0xf5, 0x84, 0x2a, 0x71, 0xe1, 0x84, + 0x50, 0xc3, 0xf7, 0x00, 0x79, 0x3c, 0x6e, 0xea, 0x38, 0x4e, 0x1a, 0xe8, 0x81, 0x5b, 0x3c, 0x33, + 0xff, 0xbf, 0x7f, 0xcf, 0x33, 0xe3, 0x67, 0x02, 0xde, 0x34, 0x90, 0xd1, 0x73, 0x88, 0xab, 0x99, + 0x6d, 0x6c, 0x1e, 0x7b, 0xc4, 0x76, 0x99, 0xed, 0x5a, 0xda, 0x49, 0x80, 0xfd, 0x9e, 0xea, 0xf9, + 0x84, 0x11, 0xb8, 0x20, 0x96, 0xa8, 0x89, 0x25, 0x6a, 0xb7, 0x5a, 0x5a, 0x36, 0x09, 0xed, 0x10, + 0xaa, 0x19, 0x88, 0xe2, 0xa8, 0x44, 0xeb, 0x56, 0x0d, 0xcc, 0x50, 0x55, 0xf3, 0x90, 0x65, 0xbb, + 0x88, 0xd9, 0xc4, 0x8d, 0xba, 0x94, 0xe6, 0x2d, 0x62, 0x11, 0xfe, 0x53, 0x0b, 0x7f, 0x89, 0xd1, + 0xe7, 0x16, 0x21, 0x96, 0x83, 0x35, 0xe4, 0xd9, 0x1a, 0x72, 0x5d, 0xc2, 0x78, 0x09, 0x15, 0xb3, + 0xca, 0x68, 0x38, 0x0f, 0xf9, 0xa8, 0x13, 0xaf, 0x59, 0x1c, 0xbd, 0x66, 0xf0, 0x14, 0xad, 0x53, + 0x7e, 0x90, 0xc0, 0xeb, 0x1f, 0x87, 0x88, 0x3a, 0x3a, 0xdd, 0xbf, 0x99, 0x3c, 0xb4, 0x29, 0xd3, + 0xf1, 0x49, 0x80, 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, 0x9d, 0x04, 0xf2, 0x51, 0xd8, 0xc0, 0xb7, 0x27, 0x20, 0x24, 0x32, 0xae, 0xb4, 0x7a, + 0xc7, 0xd5, 0x02, 0xb3, 0xc2, 0x31, 0x15, 0x58, 0xce, 0xc6, 0x8c, 0x52, 0xae, 0xfe, 0xd1, 0xe5, + 0xb5, 0x2c, 0x5d, 0x5d, 0xcb, 0xd2, 0x9f, 0xd7, 0xb2, 0xf4, 0x7d, 0x5f, 0xce, 0x5d, 0xf5, 0xe5, + 0xdc, 0xef, 0x7d, 0x39, 0xf7, 0xe5, 0x86, 0x65, 0xb3, 0x76, 0x60, 0xa8, 0x26, 0xe9, 0xc4, 0x5d, + 0xcc, 0x36, 0xb2, 0xdd, 0x9b, 0x96, 0x5f, 0x0f, 0x35, 0x65, 0x3d, 0x0f, 0x53, 0x23, 0xcf, 0xff, + 0x06, 0xaf, 0xfd, 0x13, 0x00, 0x00, 0xff, 0xff, 0xf2, 0xe5, 0x2b, 0x93, 0xf1, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1756,7 +1756,7 @@ func (m *QueryRawCheckpointListRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Status |= uint32(b&0x7F) << shift + m.Status |= CheckpointStatus(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/checkpointing/types/query.pb.gw.go b/x/checkpointing/types/query.pb.gw.go index 1eaec6da5..92fc9f3ff 100644 --- a/x/checkpointing/types/query.pb.gw.go +++ b/x/checkpointing/types/query.pb.gw.go @@ -41,6 +41,7 @@ func request_Query_RawCheckpointList_0(ctx context.Context, marshaler runtime.Ma var ( val string + e int32 ok bool err error _ = err @@ -51,12 +52,14 @@ func request_Query_RawCheckpointList_0(ctx context.Context, marshaler runtime.Ma return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status") } - protoReq.Status, err = runtime.Uint32(val) + e, err = runtime.Enum(val, CheckpointStatus_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status", err) } + protoReq.Status = CheckpointStatus(e) + if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -75,6 +78,7 @@ func local_request_Query_RawCheckpointList_0(ctx context.Context, marshaler runt var ( val string + e int32 ok bool err error _ = err @@ -85,12 +89,14 @@ func local_request_Query_RawCheckpointList_0(ctx context.Context, marshaler runt return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "status") } - protoReq.Status, err = runtime.Uint32(val) + e, err = runtime.Enum(val, CheckpointStatus_value) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "status", err) } + protoReq.Status = CheckpointStatus(e) + if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } diff --git a/x/checkpointing/types/types.go b/x/checkpointing/types/types.go index b8e53806f..20679b531 100644 --- a/x/checkpointing/types/types.go +++ b/x/checkpointing/types/types.go @@ -1,11 +1,51 @@ package types -import "bytes" +import ( + "bytes" + "github.com/cosmos/cosmos-sdk/codec" +) type BlsSigHash []byte type RawCkptHash []byte +func NewCheckpointWithMeta(ckpt *RawCheckpoint, status CheckpointStatus) *RawCheckpointWithMeta { + return &RawCheckpointWithMeta{ + Ckpt: ckpt, + Status: status, + } +} + +func RawCkptToBytes(cdc codec.BinaryCodec, ckpt *RawCheckpoint) []byte { + return cdc.MustMarshal(ckpt) +} + +func BytesToRawCkpt(cdc codec.BinaryCodec, bz []byte) (*RawCheckpoint, error) { + ckpt := new(RawCheckpoint) + err := cdc.Unmarshal(bz, ckpt) + return ckpt, err +} + +func CkptWithMetaToBytes(cdc codec.BinaryCodec, ckptWithMeta *RawCheckpointWithMeta) []byte { + return cdc.MustMarshal(ckptWithMeta) +} + +func BytesToCkptWithMeta(cdc codec.BinaryCodec, bz []byte) (*RawCheckpointWithMeta, error) { + ckptWithMeta := new(RawCheckpointWithMeta) + err := cdc.Unmarshal(bz, ckptWithMeta) + return ckptWithMeta, err +} + +func BlsSigToBytes(cdc codec.BinaryCodec, blsSig *BlsSig) []byte { + return cdc.MustMarshal(blsSig) +} + +func BytesToBlsSig(cdc codec.BinaryCodec, bz []byte) (*BlsSig, error) { + blsSig := new(BlsSig) + err := cdc.Unmarshal(bz, blsSig) + return blsSig, err +} + func (m RawCkptHash) Equals(h RawCkptHash) bool { if bytes.Compare(m.Bytes(), h.Bytes()) == 0 { return true From 16a6f1eb16c9fca2c13777beda9db522db7c7f38 Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Tue, 28 Jun 2022 20:32:01 +0800 Subject: [PATCH 15/16] minor --- proto/babylon/checkpointing/checkpoint.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/babylon/checkpointing/checkpoint.proto b/proto/babylon/checkpointing/checkpoint.proto index 3aa28b03d..eea6c7443 100644 --- a/proto/babylon/checkpointing/checkpoint.proto +++ b/proto/babylon/checkpointing/checkpoint.proto @@ -29,7 +29,7 @@ message RawCheckpointWithMeta { } // CkptStatus is the status of a checkpoint. -enum CheckpointStatus{ +enum CheckpointStatus { option (gogoproto.goproto_enum_prefix) = false; // UNCHECKPOINTED defines a checkpoint that is checkpointed on BTC. From 3e0805ce77b74eb06eb26695a01cd3fbff0b7672 Mon Sep 17 00:00:00 2001 From: Fangyu Gai Date: Tue, 28 Jun 2022 23:14:10 +0800 Subject: [PATCH 16/16] fixed ci --- x/checkpointing/keeper/keeper.go | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/x/checkpointing/keeper/keeper.go b/x/checkpointing/keeper/keeper.go index fa9598d91..fba5b7f93 100644 --- a/x/checkpointing/keeper/keeper.go +++ b/x/checkpointing/keeper/keeper.go @@ -13,12 +13,10 @@ import ( type ( Keeper struct { - cdc codec.BinaryCodec - storeKey sdk.StoreKey - memKey sdk.StoreKey - stakingKeeper types.StakingKeeper - epochingKeeper types.EpochingKeeper - paramstore paramtypes.Subspace + cdc codec.BinaryCodec + storeKey sdk.StoreKey + memKey sdk.StoreKey + paramstore paramtypes.Subspace } ) @@ -26,8 +24,6 @@ func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey sdk.StoreKey, - stakingKeeper types.StakingKeeper, - epochingKeeper types.EpochingKeeper, ps paramtypes.Subspace, ) Keeper { // set KeyTable if it has not already been set @@ -36,12 +32,10 @@ func NewKeeper( } return Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - stakingKeeper: stakingKeeper, - epochingKeeper: epochingKeeper, - paramstore: ps, + cdc: cdc, + storeKey: storeKey, + memKey: memKey, + paramstore: ps, } }