diff --git a/Makefile b/Makefile index 3282b95..7f650f7 100644 --- a/Makefile +++ b/Makefile @@ -70,8 +70,8 @@ proto-gen: go tool github.com/bufbuild/buf/cmd/buf dep update @cd modules/proto && \ go tool github.com/bufbuild/buf/cmd/buf generate - @mv modules/github.com/rollkit/go-execution-abci/modules/sequencer/types/** modules/sequencer/types/ && \ - mv modules/github.com/rollkit/go-execution-abci/modules/sequencer/module/* modules/sequencer/module/ + @mv modules/github.com/rollkit/go-execution-abci/modules/rollkitmngr/types/** modules/rollkitmngr/types/ && \ + mv modules/github.com/rollkit/go-execution-abci/modules/rollkitmngr/module/* modules/rollkitmngr/module/ @rm -r modules/github.com .PHONY: proto-gen \ No newline at end of file diff --git a/go.mod b/go.mod index 85f78bf..23c2b53 100644 --- a/go.mod +++ b/go.mod @@ -14,6 +14,7 @@ require ( cosmossdk.io/errors v1.0.2 cosmossdk.io/log v1.6.0 cosmossdk.io/math v1.5.3 + cosmossdk.io/store v1.1.1 github.com/cometbft/cometbft v0.38.17 github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.50.13 @@ -57,7 +58,6 @@ require ( connectrpc.com/connect v1.18.1 // indirect connectrpc.com/grpcreflect v1.3.0 // indirect connectrpc.com/otelconnect v0.7.2 // indirect - cosmossdk.io/store v1.1.1 // indirect cosmossdk.io/x/tx v0.13.7 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect diff --git a/modules/README.md b/modules/README.md index 843d124..a3e6f53 100644 --- a/modules/README.md +++ b/modules/README.md @@ -1,7 +1,7 @@ # Optional Cosmos SDK modules This package contains optional modules for the Cosmos SDK when using Rollkit. -They are meant to enhance the UX when using Rollkit by simplifying staking and the management of the sequencer(s). +They are meant to enhance the UX when using Rollkit by simplifying staking and the management of rollkit sequencer, attesters and migration from CometBFT to Rollkit. ## Staking @@ -10,10 +10,10 @@ It changes the way the staking module works by adding No-Ops on methods that do Think of slashing, jailing or validator updates. -## Sequencer +## Rollkit Manager -The sequencer module is a meant to easily switch between sequencers. +The `rollkitmngr` module is a meant to define attesters and sequencers in a Rollkit chain. This is the module that handles the validator updates on the SDK side. -Additionally, it has additional queries to get the sequencer information, and the future sequencer changes. +Additionally, it has additional queries to get the sequencer information, and the attesters information. -Additionally, when added to a CometBFT chain, the sequencer module will handle the switch from a CometBFT validator set to a Rollkit sequencer at a given height. +Additionally, when added to a CometBFT chain, the `rollkitmngr` module will handle the switch from a CometBFT validator set to a Rollkit sequencer at a given height. diff --git a/modules/proto/rollkitsdk/sequencer/module/v1/module.proto b/modules/proto/rollkitsdk/rollkitmngr/module/v1/module.proto similarity index 72% rename from modules/proto/rollkitsdk/sequencer/module/v1/module.proto rename to modules/proto/rollkitsdk/rollkitmngr/module/v1/module.proto index 9700311..e7e28c6 100644 --- a/modules/proto/rollkitsdk/sequencer/module/v1/module.proto +++ b/modules/proto/rollkitsdk/rollkitmngr/module/v1/module.proto @@ -1,14 +1,14 @@ syntax = "proto3"; -package rollkitsdk.sequencer.module.v1; +package rollkitsdk.rollkitmngr.module.v1; import "cosmos/app/v1alpha1/module.proto"; -option go_package = "github.com/rollkit/go-execution-abci/modules/sequencer/module"; +option go_package = "github.com/rollkit/go-execution-abci/modules/rollkitmngr/module"; // Module is the config object for the module. message Module { option (cosmos.app.v1alpha1.module) = { - go_import : "github.com/rollkit/go-execution-abci/modules/sequencer" + go_import : "github.com/rollkit/go-execution-abci/modules/rollkitmngr" }; // authority defines the custom module authority. If not set, defaults to the diff --git a/modules/proto/rollkitsdk/rollkitmngr/v1/query.proto b/modules/proto/rollkitsdk/rollkitmngr/v1/query.proto new file mode 100644 index 0000000..89fca0e --- /dev/null +++ b/modules/proto/rollkitsdk/rollkitmngr/v1/query.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; +package rollkitsdk.rollkitmngr.v1; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "rollkitsdk/rollkitmngr/v1/types.proto"; + +option go_package = "github.com/rollkit/go-execution-abci/modules/rollkitmngr/types"; + +// Query defines the gRPC querier service. +service Query { + // IsMigrating queries the sequencer changes. + rpc IsMigrating(QueryIsMigratingRequest) returns (QueryIsMigratingResponse) { + option (google.api.http).get = "/rollkit/rollkitmngr/v1/is_migrating"; + } + + // Sequencer queries the sequencer. + rpc Sequencer(QuerySequencerRequest) returns (QuerySequencerResponse) { + option (google.api.http).get = "/rollkit/rollkitmngr/v1/sequencer"; + } + + // Attesters queries the list of attesters. + rpc Attesters(QueryAttestersRequest) returns (QueryAttestersResponse) { + option (google.api.http).get = "/rollkit/rollkitmngr/v1/attesters"; + } +} + +// QueryIsMigratingRequest is request type for the Query/IsMigrating RPC method. +message QueryIsMigratingRequest {} + +// QueryIsMigratingResponse is response type for the Query/IsMigrating RPC method. +message QueryIsMigratingResponse { + // is_migrating indicates whether the chain is migrating to rollkit. + bool is_migrating = 1; + + // start_block_height is the block height at which the migration will start. + uint64 start_block_height = 2; + + // end_block_height is the block height at which the migration will end. + uint64 end_block_height = 3; +} + +// QuerySequencerRequest is request type for the Query/Sequencer RPC method. +message QuerySequencerRequest {} + +// QuerySequencerResponse is response type for the Query/Sequencer RPC method. +message QuerySequencerResponse { + // sequencer is the requested sequencer. + Sequencer sequencer = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// QueryAttestersRequest is request type for the Query/Attesters RPC method. +message QueryAttestersRequest {} + +// QueryAttestersResponse is response type for the Query/Attesters RPC method. +message QueryAttestersResponse { + // attesters is the list of attesters. + repeated Attester attesters = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} \ No newline at end of file diff --git a/modules/proto/rollkitsdk/rollkitmngr/v1/tx.proto b/modules/proto/rollkitsdk/rollkitmngr/v1/tx.proto new file mode 100644 index 0000000..c0e6b5b --- /dev/null +++ b/modules/proto/rollkitsdk/rollkitmngr/v1/tx.proto @@ -0,0 +1,66 @@ +syntax = "proto3"; +package rollkitsdk.rollkitmngr.v1; + +import "amino/amino.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "rollkitsdk/rollkitmngr/v1/types.proto"; + +option go_package = "github.com/rollkit/go-execution-abci/modules/rollkitmngr/types"; + +// Msg defines the Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // MigrateToRollkit defines a (governance) operation for the migration to rollkit. The authority defaults to the x/gov module account. + rpc MigrateToRollkit(MsgMigrateToRollkit) returns (MsgMigrateToRollkitResponse); + + // EditAttesters defines a governance operation to edit the list of attesters. + rpc EditAttesters(MsgEditAttesters) returns (MsgEditAttestersResponse); +} + +// MsgMigrateToRollkit is the Msg/MsgMigrateToRollkit request type. +message MsgMigrateToRollkit { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "rollkitmngr/v1/MsgMigrateToRollkit"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // block height that trigger the rollkit migration. + // When IBC is enabled, the migration can take several blocks to complete. + // This is the block height at which the migration will be triggered. + uint64 block_height = 2; + + // sequencer is the pubkey that will become new sequencer. + Sequencer sequencer = 3 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + // attesters is the list of attesters that will attest to blocks. + repeated Attester attesters = 4 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgMigrateToRollkitResponse defines the response structure for executing a +// MsgRollkitMigrate message. +message MsgMigrateToRollkitResponse {}; + +// MsgEditAttesters is the Msg/EditAttesters request type. +message MsgEditAttesters { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "rollkitmngr/v1/MsgEditAttesters"; + + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // attesters is the list of attesters to add or remove. + repeated Attester attesters = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgEditAttestersResponse defines the response structure for executing a +// MsgEditAttesters message. +message MsgEditAttestersResponse {}; \ No newline at end of file diff --git a/modules/proto/rollkitsdk/rollkitmngr/v1/types.proto b/modules/proto/rollkitsdk/rollkitmngr/v1/types.proto new file mode 100644 index 0000000..3eddf5f --- /dev/null +++ b/modules/proto/rollkitsdk/rollkitmngr/v1/types.proto @@ -0,0 +1,48 @@ +syntax = "proto3"; +package rollkitsdk.rollkitmngr.v1; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "google/protobuf/any.proto"; + +option go_package = "github.com/rollkit/go-execution-abci/modules/rollkitmngr/types"; + +// RollkitMigration defines the migration state from cometbft to rollkit. +message RollkitMigration { + // block height that trigger the rollkit migration. + // When IBC is enabled, the migration can take several blocks to complete. + // This is the block height at which the migration will be triggered. + uint64 block_height = 2; + + // sequencer is the pubkey that will become new sequencer. + Sequencer sequencer = 3 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + + // attesters is the list of attesters that will attest to blocks. + repeated Attester attesters = 4 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// Sequencer defines a sequence of instructions to be executed. +message Sequencer { + // name is the human-readable name of the sequencer. + string name = 1; + + // consensus_pubkey is the consensus public key of the sequencer, as a + // Protobuf Any. + google.protobuf.Any consensus_pubkey = 2 + [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey" ]; +} + + +// Attester defines an attester that can attest to blocks. +message Attester { + // name is the human-readable name of the attester. + string name = 1; + + // consensus_pubkey is the consensus public key of the attester, as a + // Protobuf Any. + google.protobuf.Any consensus_pubkey = 2 + [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey" ]; +} \ No newline at end of file diff --git a/modules/proto/rollkitsdk/sequencer/v1/query.proto b/modules/proto/rollkitsdk/sequencer/v1/query.proto deleted file mode 100644 index 94866c5..0000000 --- a/modules/proto/rollkitsdk/sequencer/v1/query.proto +++ /dev/null @@ -1,41 +0,0 @@ -syntax = "proto3"; -package rollkitsdk.sequencer.v1; - -import "amino/amino.proto"; -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "rollkitsdk/sequencer/v1/types.proto"; - -option go_package = "github.com/rollkit/go-execution-abci/modules/sequencer/types"; - -// Query defines the gRPC querier service. -service Query { - // SequencersChanges queries the sequencer changes. - rpc SequencersChanges(QuerySequencersChangesRequest) returns (QuerySequencersChangesResponse) { - option (google.api.http).get = "/rollkit/sequencer/v1/sequencers_changes"; - } - - // Sequencers queries the sequencer. - rpc Sequencers(QuerySequencersRequest) returns (QuerySequencersResponse) { - option (google.api.http).get = "/rollkit/sequencer/v1/sequencers"; - } -} - -// QuerySequencersChangesRequest is request type for the Query/SequencersChanges RPC method. -message QuerySequencersChangesRequest {} - -// QuerySequencersChangesResponse is response type for the Query/SequencersChanges RPC method. -message QuerySequencersChangesResponse { - // sequencer_changes is the list of sequencer changes. - repeated SequencerChanges sequencer_changes = 1 - [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; -} - -// QuerySequencersRequest is request type for the Query/Sequencers RPC method. -message QuerySequencersRequest {} - -// QuerySequencersResponse is response type for the Query/Sequencers RPC method. -message QuerySequencersResponse { - // sequencers is the list of sequencers. - repeated Sequencer sequencers = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; -} \ No newline at end of file diff --git a/modules/proto/rollkitsdk/sequencer/v1/tx.proto b/modules/proto/rollkitsdk/sequencer/v1/tx.proto deleted file mode 100644 index fb03287..0000000 --- a/modules/proto/rollkitsdk/sequencer/v1/tx.proto +++ /dev/null @@ -1,39 +0,0 @@ -syntax = "proto3"; -package rollkitsdk.sequencer.v1; - -import "amino/amino.proto"; -import "cosmos/msg/v1/msg.proto"; -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; -import "rollkitsdk/sequencer/v1/types.proto"; - -option go_package = "github.com/rollkit/go-execution-abci/modules/sequencer/types"; - -// Msg defines the Msg service. -service Msg { - option (cosmos.msg.v1.service) = true; - - // ChangeSequencers defines a (governance) operation for changing the - // sequencers. The authority defaults to the x/gov module account. - rpc ChangeSequencers(MsgChangeSequencers) - returns (MsgChangeSequencersResponse); -} - -// MsgChangeSequencer is the Msg/ChangeSequencer request type. -message MsgChangeSequencers { - option (cosmos.msg.v1.signer) = "authority"; - option (amino.name) = "sequencer/v1/MsgChangeSequencers"; - - // authority is the address that controls the module (defaults to x/gov unless - // overwritten). - string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - // block height that trigger the change sequencer - uint64 block_height = 2; - // sequencers is the list pubkey that will become new sequencers. - repeated Sequencer sequencers = 3 - [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; -} - -// MsgChangeSequencerResponse defines the response structure for executing a -// MsgChangeSequencer message. -message MsgChangeSequencersResponse {}; diff --git a/modules/proto/rollkitsdk/sequencer/v1/types.proto b/modules/proto/rollkitsdk/sequencer/v1/types.proto deleted file mode 100644 index 6b552ba..0000000 --- a/modules/proto/rollkitsdk/sequencer/v1/types.proto +++ /dev/null @@ -1,29 +0,0 @@ -syntax = "proto3"; -package rollkitsdk.sequencer.v1; - -import "amino/amino.proto"; -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; -import "google/protobuf/any.proto"; - -option go_package = "github.com/rollkit/go-execution-abci/modules/sequencer/types"; - -// Sequencer defines a sequence of instructions to be executed. -message Sequencer { - // name is the human-readable name of the sequence. - string name = 1; - - // consensus_pubkey is the consensus public key of the sequencer, as a - // Protobuf Any. - google.protobuf.Any consensus_pubkey = 2 - [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey" ]; -} - -// SequencerChanges defines a sequence of instructions to be executed. -message SequencerChanges { - // block height that trigger the change sequencer - uint64 block_height = 1; - // sequencers is the list pubkey that will become new sequencers. - repeated Sequencer sequencers = 2 - [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; -} \ No newline at end of file diff --git a/modules/sequencer/autocli.go b/modules/rollkitmngr/autocli.go similarity index 61% rename from modules/sequencer/autocli.go rename to modules/rollkitmngr/autocli.go index 10dbf0d..b3def60 100644 --- a/modules/sequencer/autocli.go +++ b/modules/rollkitmngr/autocli.go @@ -1,9 +1,9 @@ -package sequencer +package rollkitmngr import ( autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" - "github.com/rollkit/go-execution-abci/modules/sequencer/types" + "github.com/rollkit/go-execution-abci/modules/rollkitmngr/types" ) // AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. @@ -13,22 +13,27 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Service: types.Query_serviceDesc.ServiceName, RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { - RpcMethod: "SequencersChanges", - Use: "sequencers-changes", - Short: "Shows the upcoming sequencer changes", + RpcMethod: "Attesters", + Use: "attesters", + Short: "Shows the current attesters", }, { - RpcMethod: "Sequencers", - Use: "sequencers", + RpcMethod: "Sequencer", + Use: "sequencer", Short: "Shows the current sequencer", }, + { + RpcMethod: "IsMigrating", + Use: "is_migrating", + Short: "Shows whether the chain is migrating to rollkit", + }, }, }, Tx: &autocliv1.ServiceCommandDescriptor{ Service: types.Msg_serviceDesc.ServiceName, RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { - RpcMethod: "ChangeSequencers", + RpcMethod: "MigrateToRollkit", Skip: true, // skipped because authority gated }, }, diff --git a/modules/sequencer/depinject.go b/modules/rollkitmngr/depinject.go similarity index 71% rename from modules/sequencer/depinject.go rename to modules/rollkitmngr/depinject.go index e508ee2..a42baec 100644 --- a/modules/sequencer/depinject.go +++ b/modules/rollkitmngr/depinject.go @@ -1,6 +1,7 @@ -package sequencer +package rollkitmngr import ( + "cosmossdk.io/core/address" "cosmossdk.io/core/appmodule" "cosmossdk.io/core/store" "cosmossdk.io/depinject" @@ -9,9 +10,9 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/rollkit/go-execution-abci/modules/sequencer/keeper" - modulev1 "github.com/rollkit/go-execution-abci/modules/sequencer/module" - "github.com/rollkit/go-execution-abci/modules/sequencer/types" + "github.com/rollkit/go-execution-abci/modules/rollkitmngr/keeper" + modulev1 "github.com/rollkit/go-execution-abci/modules/rollkitmngr/module" + "github.com/rollkit/go-execution-abci/modules/rollkitmngr/types" ) // IsOnePerModuleType implements the depinject.OnePerModuleType interface. @@ -30,8 +31,11 @@ type ModuleInputs struct { Config *modulev1.Module Cdc codec.Codec StoreService store.KVStoreService + AddressCodec address.Codec + // optional, used to detect if IBC module is enabled. + // When IBC module is present, use `depinject.Provide(IBCStoreKey(ibcStoreKey))` + IBCStoreKey keeper.IbcKVStoreKeyAlias `optional:"true"` - AccountKeeper types.AccountKeeper StakingKeeper types.StakingKeeper } @@ -53,8 +57,9 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { k := keeper.NewKeeper( in.Cdc, in.StoreService, - in.AccountKeeper, + in.AddressCodec, in.StakingKeeper, + in.IBCStoreKey, authority.String(), ) m := NewAppModule(in.Cdc, k) diff --git a/modules/rollkitmngr/keeper/abci.go b/modules/rollkitmngr/keeper/abci.go new file mode 100644 index 0000000..7fe1354 --- /dev/null +++ b/modules/rollkitmngr/keeper/abci.go @@ -0,0 +1,71 @@ +package keeper + +import ( + "context" + "errors" + + abci "github.com/cometbft/cometbft/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +// 1. Migrate to sequencer only +/* + - Slowly migrate the validator set to the sequencer + - We need to check if the sequencer is already in the validator set, otherwise it would need to be added to the validator set (check what are the implications of this) + - If IBC enabled and vp of sequencer 2/3, migration can be done immediately +*/ + +// 2. Migrate to sequencer with attesters network +/* + - If IBC enabled and vp of attesters network 2/3, migration can be done immediately + - Otherwise, slowly migrate the validator set to the attesters +*/ + +// PreBlocker makes sure the chain halts at block height + 1 after the migration end. +// This is to ensure that the migration is completed with a binary switch. +func (k Keeper) PreBlocker(ctx context.Context) error { + _, end, _ := k.IsMigrating(ctx) + sdkCtx := sdk.UnwrapSDKContext(ctx) + + // one block after the migration end, we halt forcing a binary switch + if end > 0 && end+1 == uint64(sdkCtx.BlockHeight()) { + // remove the migration state from the store + // this is to ensure at restart we won't halt the chain again + if err := k.Migration.Remove(ctx); err != nil { + return sdkerrors.ErrLogic.Wrapf("failed to delete migration state: %v", err) + } + + return errors.New("app migration to rollkit is in progress, switch to the new binary and run the rollkit migration command to complete the migration") + } + + return nil +} + +// EndBlocker is called at the end of every block and returns sequencer updates. +func (k Keeper) EndBlock(ctx context.Context) ([]abci.ValidatorUpdate, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + + start, _, shouldBeMigrating := k.IsMigrating(ctx) + if !shouldBeMigrating || start > uint64(sdkCtx.BlockHeight()) { + // no migration in progress, return empty updates + return []abci.ValidatorUpdate{}, nil + } + + migration, err := k.Migration.Get(ctx) + if err != nil { + return nil, sdkerrors.ErrLogic.Wrapf("failed to get migration state: %v", err) + } + + validatorSet, err := k.stakingKeeper.GetLastValidators(sdkCtx) + if err != nil { + return nil, err + } + + if !k.isIBCEnabled(ctx) { + // if IBC is not enabled, we can migrate immediately + return k.migrateNow(ctx, migration, validatorSet) + } + + return k.migrateOver(sdkCtx, migration, validatorSet) +} diff --git a/modules/rollkitmngr/keeper/abci_test.go b/modules/rollkitmngr/keeper/abci_test.go new file mode 100644 index 0000000..9429264 --- /dev/null +++ b/modules/rollkitmngr/keeper/abci_test.go @@ -0,0 +1 @@ +package keeper_test diff --git a/modules/rollkitmngr/keeper/grpc_query.go b/modules/rollkitmngr/keeper/grpc_query.go new file mode 100644 index 0000000..18b8e1e --- /dev/null +++ b/modules/rollkitmngr/keeper/grpc_query.go @@ -0,0 +1,70 @@ +package keeper + +import ( + "context" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/rollkit/go-execution-abci/modules/rollkitmngr/types" +) + +var _ types.QueryServer = queryServer{} + +type queryServer struct { + Keeper +} + +// NewQueryServer creates a new instance of the sequencer query server. +func NewQueryServer(keeper Keeper) types.QueryServer { + return queryServer{Keeper: keeper} +} + +// Attesters returns the current attesters. +// Note it is only a wrapper around the staking module's query. +// If the sequencer and attesters are equals, then the chain is not using attesters. +func (q queryServer) Attesters(ctx context.Context, _ *types.QueryAttestersRequest) (*types.QueryAttestersResponse, error) { + vals, err := q.stakingKeeper.GetLastValidators(ctx) + if err != nil { + return nil, sdkerrors.ErrLogic.Wrapf("failed to get last validators: %v", err) + } + + attesters := make([]types.Attester, len(vals)) + for i, val := range vals { + attesters[i] = types.Attester{ + Name: val.GetMoniker(), + ConsensusPubkey: val.ConsensusPubkey, + } + } + + return &types.QueryAttestersResponse{ + Attesters: attesters, + }, nil +} + +// IsMigrating checks if the migration to Rollkit is in progress. +func (q queryServer) IsMigrating(ctx context.Context, _ *types.QueryIsMigratingRequest) (*types.QueryIsMigratingResponse, error) { + start, end, isMigrating := q.Keeper.IsMigrating(ctx) + + return &types.QueryIsMigratingResponse{ + IsMigrating: isMigrating, + StartBlockHeight: start, + EndBlockHeight: end, + }, nil +} + +// Sequencer returns the current Sequencer. +func (q queryServer) Sequencer(ctx context.Context, _ *types.QuerySequencerRequest) (*types.QuerySequencerResponse, error) { + _, _, migrationInProgress := q.Keeper.IsMigrating(ctx) + if migrationInProgress { + return nil, sdkerrors.ErrLogic.Wrap("sequencer is not set, migration is in progress or not started yet") + } + + seq, err := q.Keeper.Sequencer.Get(ctx) + if err != nil { + return nil, sdkerrors.ErrLogic.Wrapf("failed to get sequencer: %v", err) + } + + return &types.QuerySequencerResponse{ + Sequencer: seq, + }, nil +} diff --git a/modules/rollkitmngr/keeper/grpc_query_test.go b/modules/rollkitmngr/keeper/grpc_query_test.go new file mode 100644 index 0000000..4e0a29b --- /dev/null +++ b/modules/rollkitmngr/keeper/grpc_query_test.go @@ -0,0 +1,197 @@ +package keeper_test + +import ( + "bytes" + "context" + "errors" + "testing" + + storetypes "cosmossdk.io/store/types" + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/testutil" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/stretchr/testify/require" + + "github.com/rollkit/go-execution-abci/modules/rollkitmngr" + "github.com/rollkit/go-execution-abci/modules/rollkitmngr/keeper" + "github.com/rollkit/go-execution-abci/modules/rollkitmngr/types" +) + +// mockStakingKeeper is a minimal mock for stakingKeeper used in Attesters tests. +type mockStakingKeeper struct { + vals []stakingtypes.Validator + err error +} + +func (m *mockStakingKeeper) GetValidatorByConsAddr(ctx context.Context, consAddr sdk.ConsAddress) (stakingtypes.Validator, error) { + for _, val := range m.vals { + if valBz, err := val.GetConsAddr(); err == nil && bytes.Equal(valBz, consAddr) { + return val, nil + } + } + return stakingtypes.Validator{}, stakingtypes.ErrNoValidatorFound +} + +func (m *mockStakingKeeper) GetLastValidators(context.Context) ([]stakingtypes.Validator, error) { + return m.vals, m.err +} + +func (m *mockStakingKeeper) IterateBondedValidatorsByPower(ctx context.Context, cb func(index int64, validator stakingtypes.ValidatorI) (stop bool)) error { + for i, val := range m.vals { + if cb(int64(i), val) { + break + } + } + return nil +} + +type fixture struct { + ctx sdk.Context + kvStoreKey *storetypes.KVStoreKey + + stakingKeeper *mockStakingKeeper + keeper keeper.Keeper + queryServer types.QueryServer + msgServer types.MsgServer +} + +func initFixture(tb testing.TB) *fixture { + tb.Helper() + + stakingKeeper := &mockStakingKeeper{} + key := storetypes.NewKVStoreKey(types.ModuleName) + storeService := runtime.NewKVStoreService(key) + encCfg := moduletestutil.MakeTestEncodingConfig(rollkitmngr.AppModuleBasic{}) + addressCodec := addresscodec.NewBech32Codec("cosmos") + ctx := testutil.DefaultContext(key, storetypes.NewTransientStoreKey("transient")) + + k := keeper.NewKeeper( + encCfg.Codec, + storeService, + addressCodec, + stakingKeeper, + nil, + sdk.AccAddress(address.Module(types.ModuleName)).String(), + ) + + return &fixture{ + ctx: ctx, + kvStoreKey: key, + stakingKeeper: stakingKeeper, + keeper: k, + queryServer: keeper.NewQueryServer(k), + msgServer: keeper.NewMsgServerImpl(k), + } +} + +func TestAttesters_Success(t *testing.T) { + s := initFixture(t) + + // attesters returns the current attesters + s.stakingKeeper.vals = []stakingtypes.Validator{{Description: stakingtypes.NewDescription("foo", "", "", "", "")}} + s.stakingKeeper.err = nil + + resp, err := s.queryServer.Attesters(s.ctx, &types.QueryAttestersRequest{}) + require.NoError(t, err) + require.Len(t, resp.Attesters, 1) + require.Equal(t, "foo", resp.Attesters[0].Name) +} + +func TestAttesters_Error(t *testing.T) { + s := initFixture(t) + + s.stakingKeeper.err = errors.New("fail") + resp, err := s.queryServer.Attesters(s.ctx, &types.QueryAttestersRequest{}) + require.Error(t, err) + require.Nil(t, resp) +} + +func TestIsMigrating(t *testing.T) { + s := initFixture(t) + + // set up migration + require.NoError(t, s.keeper.Migration.Set(s.ctx, types.RollkitMigration{ + BlockHeight: 1, + Sequencer: types.Sequencer{Name: "foo"}, + })) + + s.ctx = s.ctx.WithBlockHeight(1) + resp, err := s.queryServer.IsMigrating(s.ctx, &types.QueryIsMigratingRequest{}) + require.NoError(t, err) + require.True(t, resp.IsMigrating) + require.Equal(t, uint64(1), resp.StartBlockHeight) + require.Equal(t, uint64(2), resp.EndBlockHeight) +} + +func TestIsMigrating_IBCEnabled(t *testing.T) { + stakingKeeper := &mockStakingKeeper{} + key := storetypes.NewKVStoreKey(types.ModuleName) + storeService := runtime.NewKVStoreService(key) + encCfg := moduletestutil.MakeTestEncodingConfig(rollkitmngr.AppModuleBasic{}) + addressCodec := addresscodec.NewBech32Codec("cosmos") + ibcKey := storetypes.NewKVStoreKey("ibc") + ctx := testutil.DefaultContextWithKeys(map[string]*storetypes.KVStoreKey{ + types.ModuleName: key, + "ibc": ibcKey, + }, nil, nil) + + k := keeper.NewKeeper( + encCfg.Codec, + storeService, + addressCodec, + stakingKeeper, + func() *storetypes.KVStoreKey { return key }, + sdk.AccAddress(address.Module(types.ModuleName)).String(), + ) + + // set up migration + require.NoError(t, k.Migration.Set(ctx, types.RollkitMigration{ + BlockHeight: 1, + Sequencer: types.Sequencer{Name: "foo"}, + })) + + ctx = ctx.WithBlockHeight(1) + resp, err := keeper.NewQueryServer(k).IsMigrating(ctx, &types.QueryIsMigratingRequest{}) + require.NoError(t, err) + require.True(t, resp.IsMigrating) + require.Equal(t, uint64(1), resp.StartBlockHeight) + require.Equal(t, 1+keeper.IBCSmoothingFactor, resp.EndBlockHeight) +} + +func TestSequencer_Migrating(t *testing.T) { + s := initFixture(t) + + // set up migration + require.NoError(t, s.keeper.Migration.Set(s.ctx, types.RollkitMigration{ + BlockHeight: 1, + Sequencer: types.Sequencer{Name: "foo"}, + })) + + resp, err := s.queryServer.Sequencer(s.ctx, &types.QuerySequencerRequest{}) + require.Error(t, err) + require.Nil(t, resp) +} + +func TestSequencer_Success(t *testing.T) { + s := initFixture(t) + + // sequencer returns the current sequencer + seq := types.Sequencer{Name: "foo"} + require.NoError(t, s.keeper.Sequencer.Set(s.ctx, seq)) + + resp, err := s.queryServer.Sequencer(s.ctx, &types.QuerySequencerRequest{}) + require.NoError(t, err) + require.Equal(t, seq, resp.Sequencer) +} + +func TestSequencer_Error(t *testing.T) { + s := initFixture(t) + + resp, err := s.queryServer.Sequencer(s.ctx, &types.QuerySequencerRequest{}) + require.Error(t, err) + require.Nil(t, resp) +} diff --git a/modules/rollkitmngr/keeper/keeper.go b/modules/rollkitmngr/keeper/keeper.go new file mode 100644 index 0000000..fe31c83 --- /dev/null +++ b/modules/rollkitmngr/keeper/keeper.go @@ -0,0 +1,143 @@ +package keeper + +import ( + "context" + "errors" + + "cosmossdk.io/collections" + "cosmossdk.io/core/address" + corestore "cosmossdk.io/core/store" + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/rollkit/go-execution-abci/modules/rollkitmngr/types" +) + +// IbcStoreKey is the store key used for IBC-related data. +// It is an alias for storetypes.StoreKey to allow depinject to resolve it as a dependency (as runtime assumes 1 module = 1 store key maximum). +type IbcKVStoreKeyAlias = func() *storetypes.KVStoreKey + +type Keeper struct { + storeService corestore.KVStoreService + cdc codec.BinaryCodec + addressCodec address.Codec + authority string + + ibcStoreKey IbcKVStoreKeyAlias + stakingKeeper types.StakingKeeper + + Schema collections.Schema + Sequencer collections.Item[types.Sequencer] + Migration collections.Item[types.RollkitMigration] + MigrationStep collections.Item[uint64] +} + +// NewKeeper creates a new sequencer Keeper instance. +func NewKeeper( + cdc codec.BinaryCodec, + storeService corestore.KVStoreService, + addressCodec address.Codec, + stakingKeeper types.StakingKeeper, + ibcStoreKey IbcKVStoreKeyAlias, + authority string, +) Keeper { + // ensure that authority is a valid account address + if _, err := addressCodec.StringToBytes(authority); err != nil { + panic("authority is not a valid acc address") + } + + sb := collections.NewSchemaBuilder(storeService) + k := Keeper{ + storeService: storeService, + cdc: cdc, + authority: authority, + addressCodec: addressCodec, + stakingKeeper: stakingKeeper, + ibcStoreKey: ibcStoreKey, + Sequencer: collections.NewItem( + sb, + types.SequencerKey, + "sequencer", + codec.CollValue[types.Sequencer](cdc), + ), + Migration: collections.NewItem( + sb, + types.MigrationKey, + "rollkit_migration", + codec.CollValue[types.RollkitMigration](cdc), + ), + MigrationStep: collections.NewItem( + sb, + types.MigrationStepKey, + "migration_step", + collections.Uint64Value, + ), + } + + schema, err := sb.Build() + if err != nil { + panic(err) + } + k.Schema = schema + + return k +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger(ctx context.Context) log.Logger { + sdkCtx := sdk.UnwrapSDKContext(ctx) + return sdkCtx.Logger().With("module", "x/"+types.ModuleName) +} + +// IsMigrating checks if the migration to Rollkit is in progress. +// It checks if the RollkitMigration item exists in the store. +// And if it does, it verifies we are past the block height that started the migration. +func (k Keeper) IsMigrating(ctx context.Context) (start, end uint64, ok bool) { + migration, err := k.Migration.Get(ctx) + if errors.Is(err, collections.ErrNotFound) { + return 0, 0, false + } else if err != nil { + k.Logger(ctx).Error("failed to get Rollkit migration state", "error", err) + return 0, 0, false + } + + // smoothen the migration over IBCSmoothingFactor blocks, in order to migrate the validator set to the sequencer or attesters network when IBC is enabled. + migrationEndHeight := migration.BlockHeight + IBCSmoothingFactor + + // If IBC is not enabled, the migration can be done in one block. + if !k.isIBCEnabled(ctx) { + migrationEndHeight = migration.BlockHeight + 1 + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + currentHeight := uint64(sdkCtx.BlockHeight()) + migrationInProgress := currentHeight >= migration.BlockHeight && currentHeight <= migrationEndHeight + + return migration.BlockHeight, migrationEndHeight, migrationInProgress +} + +// isIBCEnabled checks if IBC is enabled on the chain. +// In order to not import the IBC module, we only check if the IBC store exists, +// but not the ibc params. This should be sufficient for our use case. +func (k Keeper) isIBCEnabled(ctx context.Context) (enabled bool) { + if k.ibcStoreKey == nil { + return false + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + + ms := sdkCtx.MultiStore().CacheMultiStore() + defer func() { + if r := recover(); r != nil { + // If we panic, it means the store does not exist, so IBC is not enabled. + enabled = false + } + }() + ms.GetKVStore(k.ibcStoreKey()) + + enabled = true // has not panicked, so store exists + + return +} diff --git a/modules/rollkitmngr/keeper/migration.go b/modules/rollkitmngr/keeper/migration.go new file mode 100644 index 0000000..11ee575 --- /dev/null +++ b/modules/rollkitmngr/keeper/migration.go @@ -0,0 +1,205 @@ +package keeper + +import ( + "context" + "errors" + + "cosmossdk.io/collections" + abci "github.com/cometbft/cometbft/abci/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/rollkit/go-execution-abci/modules/rollkitmngr/types" +) + +// IBCSmoothingFactor is the factor used to smooth the migration process when IBC is enabled. It determines how many blocks the migration will take. +var IBCSmoothingFactor uint64 = 30 + +// migrateNow migrates the chain to rollkit immediately. +// this method is used when ibc is not enabled, so no migration smoothing is needed. +func (k Keeper) migrateNow( + ctx context.Context, + migrationData types.RollkitMigration, + lastValidatorSet []stakingtypes.Validator, +) (initialValUpdates []abci.ValidatorUpdate, err error) { + switch len(migrationData.Attesters) { + case 0: + // no attesters, we are migrating to a single sequencer + initialValUpdates, err = migrateToSequencer(migrationData, lastValidatorSet) + if err != nil { + return nil, sdkerrors.ErrInvalidRequest.Wrapf("failed to migrate to sequencer: %v", err) + } + default: + // we are migrating the validator set to attesters + initialValUpdates, err = migrateToAttesters(migrationData, lastValidatorSet) + if err != nil { + return nil, sdkerrors.ErrInvalidRequest.Wrapf("failed to migrate to sequencer & attesters: %v", err) + } + } + + // set new sequencer in the store + // it will be used by the rollkit migration command when using attesters + seq := migrationData.Sequencer + if err := k.Sequencer.Set(ctx, seq); err != nil { + return nil, sdkerrors.ErrInvalidRequest.Wrapf("failed to set sequencer: %v", err) + } + + return initialValUpdates, nil +} + +// migrateToSequencer migrates the chain to a single sequencer. +// the validator set is updated to include the sequencer and remove all other validators. +func migrateToSequencer( + migrationData types.RollkitMigration, + lastValidatorSet []stakingtypes.Validator, +) (initialValUpdates []abci.ValidatorUpdate, err error) { + seq := migrationData.Sequencer + + pk, err := seq.TmConsPublicKey() + if err != nil { + return nil, err + } + sequencerUpdate := abci.ValidatorUpdate{ + PubKey: pk, + Power: 1, + } + + for _, val := range lastValidatorSet { + powerUpdate := val.ABCIValidatorUpdateZero() + if val.ConsensusPubkey.Equal(seq.ConsensusPubkey) { + continue + } + initialValUpdates = append(initialValUpdates, powerUpdate) + } + + return append(initialValUpdates, sequencerUpdate), nil +} + +// migrateToAttesters migrates the chain to attesters. +// the validator set is updated to include the attesters and remove all other validators. +func migrateToAttesters( + migrationData types.RollkitMigration, + lastValidatorSet []stakingtypes.Validator, +) (initialValUpdates []abci.ValidatorUpdate, err error) { + // First, remove all existing validators that are not attesters + attesterPubKeys := make(map[string]bool) + for _, attester := range migrationData.Attesters { + key := attester.ConsensusPubkey.String() + attesterPubKeys[key] = true + } + + // Remove validators that are not attesters + for _, val := range lastValidatorSet { + if !attesterPubKeys[val.ConsensusPubkey.String()] { + powerUpdate := val.ABCIValidatorUpdateZero() + initialValUpdates = append(initialValUpdates, powerUpdate) + } + } + + // Add attesters with power 1 + for _, attester := range migrationData.Attesters { + pk, err := attester.TmConsPublicKey() + if err != nil { + return nil, err + } + attesterUpdate := abci.ValidatorUpdate{ + PubKey: pk, + Power: 1, + } + initialValUpdates = append(initialValUpdates, attesterUpdate) + } + + return initialValUpdates, nil +} + +// migrateOver migrates the chain to rollkit over a period of blocks. +// this is to ensure ibc light client verification keep working while changing the whole validator set. +// the migration step is tracked in store. +func (k Keeper) migrateOver( + ctx context.Context, + migrationData types.RollkitMigration, + lastValidatorSet []stakingtypes.Validator, +) (initialValUpdates []abci.ValidatorUpdate, err error) { + step, err := k.MigrationStep.Get(ctx) + if err != nil && !errors.Is(err, collections.ErrNotFound) { + return nil, sdkerrors.ErrInvalidRequest.Wrapf("failed to get migration step: %v", err) + } + + if step >= IBCSmoothingFactor { + // migration complete, just return the final set (same as migrateNow) + if err := k.MigrationStep.Remove(ctx); err != nil { + return nil, sdkerrors.ErrInvalidRequest.Wrapf("failed to remove migration step: %v", err) + } + return k.migrateNow(ctx, migrationData, lastValidatorSet) + } + + switch len(migrationData.Attesters) { + case 0: + // no attesters, migrate to a single sequencer over smoothing period + // remove all validators except the sequencer, add sequencer at the end + seq := migrationData.Sequencer + var oldValsToRemove []stakingtypes.Validator + for _, val := range lastValidatorSet { + if !val.ConsensusPubkey.Equal(seq.ConsensusPubkey) { + oldValsToRemove = append(oldValsToRemove, val) + } + } + removePerStep := (len(oldValsToRemove) + int(IBCSmoothingFactor) - 1) / int(IBCSmoothingFactor) + startRemove := int(step) * removePerStep + endRemove := min(startRemove+removePerStep, len(oldValsToRemove)) + for _, val := range oldValsToRemove[startRemove:endRemove] { + powerUpdate := val.ABCIValidatorUpdateZero() + initialValUpdates = append(initialValUpdates, powerUpdate) + } + default: + // attesters present, migrate as before + attesterPubKeys := make(map[string]struct{}) + for _, attester := range migrationData.Attesters { + attesterPubKeys[attester.ConsensusPubkey.String()] = struct{}{} + } + var oldValsToRemove []stakingtypes.Validator + for _, val := range lastValidatorSet { + if _, ok := attesterPubKeys[val.ConsensusPubkey.String()]; !ok { + oldValsToRemove = append(oldValsToRemove, val) + } + } + lastValPubKeys := make(map[string]struct{}) + for _, val := range lastValidatorSet { + lastValPubKeys[val.ConsensusPubkey.String()] = struct{}{} + } + var newAttestersToAdd []types.Attester + for _, attester := range migrationData.Attesters { + if _, ok := lastValPubKeys[attester.ConsensusPubkey.String()]; !ok { + newAttestersToAdd = append(newAttestersToAdd, attester) + } + } + removePerStep := (len(oldValsToRemove) + int(IBCSmoothingFactor) - 1) / int(IBCSmoothingFactor) + addPerStep := (len(newAttestersToAdd) + int(IBCSmoothingFactor) - 1) / int(IBCSmoothingFactor) + startRemove := int(step) * removePerStep + endRemove := min(startRemove+removePerStep, len(oldValsToRemove)) + for _, val := range oldValsToRemove[startRemove:endRemove] { + powerUpdate := val.ABCIValidatorUpdateZero() + initialValUpdates = append(initialValUpdates, powerUpdate) + } + startAdd := int(step) * addPerStep + endAdd := min(startAdd+addPerStep, len(newAttestersToAdd)) + for _, attester := range newAttestersToAdd[startAdd:endAdd] { + pk, err := attester.TmConsPublicKey() + if err != nil { + return nil, sdkerrors.ErrInvalidRequest.Wrapf("failed to get attester pubkey: %v", err) + } + attesterUpdate := abci.ValidatorUpdate{ + PubKey: pk, + Power: 1, + } + initialValUpdates = append(initialValUpdates, attesterUpdate) + } + } + + // increment and persist the step + if err := k.MigrationStep.Set(ctx, step+1); err != nil { + return nil, sdkerrors.ErrInvalidRequest.Wrapf("failed to set migration step: %v", err) + } + + return initialValUpdates, nil +} diff --git a/modules/rollkitmngr/keeper/msg_server.go b/modules/rollkitmngr/keeper/msg_server.go new file mode 100644 index 0000000..9299a57 --- /dev/null +++ b/modules/rollkitmngr/keeper/msg_server.go @@ -0,0 +1,83 @@ +package keeper + +import ( + "context" + + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/rollkit/go-execution-abci/modules/rollkitmngr/types" +) + +var _ types.MsgServer = &msgServer{} + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of sequencer MsgServer interface. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +func (m *msgServer) MigrateToRollkit(ctx context.Context, msg *types.MsgMigrateToRollkit) (*types.MsgMigrateToRollkitResponse, error) { + if m.authority != msg.Authority { + return nil, govtypes.ErrInvalidSigner.Wrapf("invalid authority; expected %s, got %s", m.authority, msg.Authority) + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + if msg.BlockHeight < uint64(sdkCtx.BlockHeight()) { + return nil, sdkerrors.ErrInvalidRequest.Wrapf("block height %d must be greater than current block height %d", msg.BlockHeight, sdkCtx.BlockHeight()) + } + + s := types.RollkitMigration{ + BlockHeight: msg.BlockHeight, + Sequencer: msg.Sequencer, + Attesters: msg.Attesters, + } + + if err := m.Migration.Set(ctx, s); err != nil { + return nil, sdkerrors.ErrInvalidRequest.Wrapf("failed to set migration state: %v", err) + } + + return &types.MsgMigrateToRollkitResponse{}, nil +} + +// EditAttesters is a gov gated method that allows the authority to edit the list of attesters. +func (m *msgServer) EditAttesters(ctx context.Context, msg *types.MsgEditAttesters) (*types.MsgEditAttestersResponse, error) { + if m.authority != msg.Authority { + return nil, govtypes.ErrInvalidSigner.Wrapf("invalid authority; expected %s, got %s", m.authority, msg.Authority) + } + + // TODO support adding attesters after the fact. + + attesters := make(map[string]struct{}) + for _, attester := range msg.Attesters { + if attester.Name == "" || attester.ConsensusPubkey == nil { + return nil, sdkerrors.ErrInvalidRequest.Wrap("attester name and consensus public key must not be empty") + } + + if _, exists := attesters[attester.ConsensusPubkey.String()]; exists { + return nil, sdkerrors.ErrInvalidRequest.Wrapf("duplicate attester consensus public key: %s", attester.ConsensusPubkey.String()) + } + + attesters[attester.ConsensusPubkey.String()] = struct{}{} + + consPubInterface := attester.ConsensusPubkey.GetCachedValue() + consPub, ok := consPubInterface.(cryptotypes.PubKey) + if !ok { + return nil, sdkerrors.ErrInvalidRequest.Wrapf("invalid consensus public key type for attester %s", attester.Name) + } + + _, err := m.stakingKeeper.GetValidatorByConsAddr(ctx, sdk.ConsAddress(consPub.Address())) + if err != nil { + return nil, sdkerrors.ErrInvalidRequest.Wrapf("failed to get validator by consensus address %s: %v", consPub.Address(), err) + } + } + + // update the validators + + return &types.MsgEditAttestersResponse{}, nil +} diff --git a/modules/rollkitmngr/keeper/msg_server_test.go b/modules/rollkitmngr/keeper/msg_server_test.go new file mode 100644 index 0000000..877f3b1 --- /dev/null +++ b/modules/rollkitmngr/keeper/msg_server_test.go @@ -0,0 +1,133 @@ +package keeper_test + +import ( + "testing" + + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/stretchr/testify/require" + + "github.com/rollkit/go-execution-abci/modules/rollkitmngr/types" +) + +// helper to create a dummy consensus pubkey Any +func dummyConsensusPubkeyAny() *codectypes.Any { + pub, _ := codectypes.NewAnyWithValue(ed25519.GenPrivKey().PubKey()) + return pub +} + +func TestMigrateToRollkit_AuthorityError(t *testing.T) { + s := initFixture(t) + msg := &types.MsgMigrateToRollkit{Authority: "bad"} + _, err := s.msgServer.MigrateToRollkit(s.ctx, msg) + require.Error(t, err) + require.Contains(t, err.Error(), "invalid authority") +} + +func TestMigrateToRollkit_BlockHeightError(t *testing.T) { + s := initFixture(t) + auth := sdk.AccAddress(address.Module(types.ModuleName)).String() + msg := &types.MsgMigrateToRollkit{Authority: auth, BlockHeight: 1} + s.ctx = s.ctx.WithBlockHeight(2) + _, err := s.msgServer.MigrateToRollkit(s.ctx, msg) + require.Error(t, err) + require.Contains(t, err.Error(), "block height") +} + +func TestMigrateToRollkit_Success(t *testing.T) { + s := initFixture(t) + auth := sdk.AccAddress(address.Module(types.ModuleName)).String() + msg := &types.MsgMigrateToRollkit{Authority: auth, BlockHeight: 10} + resp, err := s.msgServer.MigrateToRollkit(s.ctx, msg) + require.NoError(t, err) + require.NotNil(t, resp) +} + +func TestEditAttesters_AuthorityError(t *testing.T) { + s := initFixture(t) + msg := &types.MsgEditAttesters{Authority: "bad"} + _, err := s.msgServer.EditAttesters(s.ctx, msg) + require.Error(t, err) + require.Contains(t, err.Error(), "invalid authority") +} + +func TestEditAttesters_EmptyFields(t *testing.T) { + s := initFixture(t) + auth := sdk.AccAddress(address.Module(types.ModuleName)).String() + msg := &types.MsgEditAttesters{ + Authority: auth, + Attesters: []types.Attester{{Name: "", ConsensusPubkey: nil}}, + } + _, err := s.msgServer.EditAttesters(s.ctx, msg) + require.Error(t, err) + require.Contains(t, err.Error(), "must not be empty") +} + +func TestEditAttesters_DuplicateKey(t *testing.T) { + s := initFixture(t) + pubkey := dummyConsensusPubkeyAny() + s.stakingKeeper.vals = []stakingtypes.Validator{ + {ConsensusPubkey: pubkey}, + } + + auth := sdk.AccAddress(address.Module(types.ModuleName)).String() + msg := &types.MsgEditAttesters{ + Authority: auth, + Attesters: []types.Attester{ + {Name: "a", ConsensusPubkey: pubkey}, + {Name: "b", ConsensusPubkey: pubkey}, + }, + } + _, err := s.msgServer.EditAttesters(s.ctx, msg) + require.Error(t, err) + require.Contains(t, err.Error(), "duplicate attester consensus public key") +} + +func TestEditAttesters_InvalidPubKeyType(t *testing.T) { + s := initFixture(t) + auth := sdk.AccAddress(address.Module(types.ModuleName)).String() + invalidAny := &codectypes.Any{TypeUrl: "/invalid", Value: []byte("bad")} + msg := &types.MsgEditAttesters{ + Authority: auth, + Attesters: []types.Attester{{Name: "a", ConsensusPubkey: invalidAny}}, + } + _, err := s.msgServer.EditAttesters(s.ctx, msg) + require.Error(t, err) + require.Contains(t, err.Error(), "invalid consensus public key type") +} + +func TestEditAttesters_ValidatorNotFound(t *testing.T) { + s := initFixture(t) + auth := sdk.AccAddress(address.Module(types.ModuleName)).String() + pubkey := dummyConsensusPubkeyAny() + msg := &types.MsgEditAttesters{ + Authority: auth, + Attesters: []types.Attester{{Name: "a", ConsensusPubkey: pubkey}}, + } + _, err := s.msgServer.EditAttesters(s.ctx, msg) + require.Error(t, err) + require.Contains(t, err.Error(), "failed to get validator by consensus address") +} + +func TestEditAttesters_Success(t *testing.T) { + s := initFixture(t) + auth := sdk.AccAddress(address.Module(types.ModuleName)).String() + pubkey := dummyConsensusPubkeyAny() + s.stakingKeeper.vals = []stakingtypes.Validator{ + { + Description: stakingtypes.NewDescription("a", "", "", "", ""), + ConsensusPubkey: pubkey, + }, + } + + msg := &types.MsgEditAttesters{ + Authority: auth, + Attesters: []types.Attester{{Name: "a", ConsensusPubkey: pubkey}}, + } + resp, err := s.msgServer.EditAttesters(s.ctx, msg) + require.NoError(t, err) + require.NotNil(t, resp) +} diff --git a/modules/sequencer/module.go b/modules/rollkitmngr/module.go similarity index 85% rename from modules/sequencer/module.go rename to modules/rollkitmngr/module.go index 2f8d513..452c8e1 100644 --- a/modules/sequencer/module.go +++ b/modules/rollkitmngr/module.go @@ -1,4 +1,4 @@ -package sequencer +package rollkitmngr import ( "context" @@ -12,8 +12,8 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/rollkit/go-execution-abci/modules/sequencer/keeper" - "github.com/rollkit/go-execution-abci/modules/sequencer/types" + "github.com/rollkit/go-execution-abci/modules/rollkitmngr/keeper" + "github.com/rollkit/go-execution-abci/modules/rollkitmngr/types" ) var ( @@ -44,12 +44,12 @@ type AppModule struct { keeper keeper.Keeper } -// Name returns the sequencer module's name +// Name returns the rollkitmngr module's name func (am AppModuleBasic) Name() string { return types.ModuleName } -// RegisterLegacyAminoCodec registers the sequencer module's types on the given LegacyAmino codec. +// RegisterLegacyAminoCodec registers the rollkitmngr module's types on the given LegacyAmino codec. func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { types.RegisterLegacyAminoCodec(cdc) } @@ -59,12 +59,12 @@ func (AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) { types.RegisterInterfaces(registry) } -// ValidateGenesis performs genesis state validation for the sequencer module. +// ValidateGenesis performs genesis state validation for the rollkitmngr module. func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { return nil } -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the sequencer module. +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the rollkitmngr module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *gwruntime.ServeMux) { if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { panic(err) diff --git a/modules/sequencer/module/module.pb.go b/modules/rollkitmngr/module/module.pb.go similarity index 80% rename from modules/sequencer/module/module.pb.go rename to modules/rollkitmngr/module/module.pb.go index 5a3e633..46ac191 100644 --- a/modules/sequencer/module/module.pb.go +++ b/modules/rollkitmngr/module/module.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: rollkitsdk/sequencer/module/v1/module.proto +// source: rollkitsdk/rollkitmngr/module/v1/module.proto package module @@ -34,7 +34,7 @@ func (m *Module) Reset() { *m = Module{} } func (m *Module) String() string { return proto.CompactTextString(m) } func (*Module) ProtoMessage() {} func (*Module) Descriptor() ([]byte, []int) { - return fileDescriptor_f93368bb1171ca5c, []int{0} + return fileDescriptor_f19001b7f9e2e548, []int{0} } func (m *Module) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -71,29 +71,29 @@ func (m *Module) GetAuthority() string { } func init() { - proto.RegisterType((*Module)(nil), "rollkitsdk.sequencer.module.v1.Module") + proto.RegisterType((*Module)(nil), "rollkitsdk.rollkitmngr.module.v1.Module") } func init() { - proto.RegisterFile("rollkitsdk/sequencer/module/v1/module.proto", fileDescriptor_f93368bb1171ca5c) + proto.RegisterFile("rollkitsdk/rollkitmngr/module/v1/module.proto", fileDescriptor_f19001b7f9e2e548) } -var fileDescriptor_f93368bb1171ca5c = []byte{ - // 213 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2e, 0xca, 0xcf, 0xc9, - 0xc9, 0xce, 0x2c, 0x29, 0x4e, 0xc9, 0xd6, 0x2f, 0x4e, 0x2d, 0x2c, 0x4d, 0xcd, 0x4b, 0x4e, 0x2d, - 0xd2, 0xcf, 0xcd, 0x4f, 0x29, 0xcd, 0x49, 0xd5, 0x2f, 0x33, 0x84, 0xb2, 0xf4, 0x0a, 0x8a, 0xf2, - 0x4b, 0xf2, 0x85, 0xe4, 0x10, 0x8a, 0xf5, 0xe0, 0x8a, 0xf5, 0xa0, 0x4a, 0xca, 0x0c, 0xa5, 0x14, - 0x92, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xf5, 0x13, 0x0b, 0x0a, 0xf4, 0xcb, 0x0c, 0x13, 0x73, 0x0a, - 0x32, 0x12, 0x51, 0x4d, 0x50, 0x4a, 0xe3, 0x62, 0xf3, 0x05, 0xf3, 0x85, 0x64, 0xb8, 0x38, 0x13, - 0x4b, 0x4b, 0x32, 0xf2, 0x8b, 0x32, 0x4b, 0x2a, 0x25, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0x10, - 0x02, 0x56, 0x76, 0xbb, 0x0e, 0x4c, 0xbb, 0xc5, 0x68, 0xc1, 0x65, 0x96, 0x9e, 0x59, 0x92, 0x51, - 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0xb5, 0x5c, 0x3f, 0x3d, 0x5f, 0x37, 0xb5, 0x22, 0x35, - 0xb9, 0xb4, 0x24, 0x33, 0x3f, 0x4f, 0x37, 0x31, 0x29, 0x39, 0x13, 0x6a, 0x45, 0x31, 0xc2, 0x03, - 0x4e, 0xe1, 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, 0x4b, 0x9e, 0x89, - 0x50, 0x91, 0x24, 0x36, 0xb0, 0x3f, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3d, 0x90, 0x75, - 0x20, 0x38, 0x01, 0x00, 0x00, +var fileDescriptor_f19001b7f9e2e548 = []byte{ + // 209 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2d, 0xca, 0xcf, 0xc9, + 0xc9, 0xce, 0x2c, 0x29, 0x4e, 0xc9, 0xd6, 0x87, 0x32, 0x73, 0xf3, 0xd2, 0x8b, 0xf4, 0x73, 0xf3, + 0x53, 0x4a, 0x73, 0x52, 0xf5, 0xcb, 0x0c, 0xa1, 0x2c, 0xbd, 0x82, 0xa2, 0xfc, 0x92, 0x7c, 0x21, + 0x05, 0x84, 0x72, 0x3d, 0x24, 0xe5, 0x7a, 0x50, 0x45, 0x65, 0x86, 0x52, 0x0a, 0xc9, 0xf9, 0xc5, + 0xb9, 0xf9, 0xc5, 0xfa, 0x89, 0x05, 0x05, 0xfa, 0x65, 0x86, 0x89, 0x39, 0x05, 0x19, 0x89, 0xa8, + 0x66, 0x28, 0x65, 0x70, 0xb1, 0xf9, 0x82, 0xf9, 0x42, 0x32, 0x5c, 0x9c, 0x89, 0xa5, 0x25, 0x19, + 0xf9, 0x45, 0x99, 0x25, 0x95, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x08, 0x01, 0x2b, 0x87, + 0x5d, 0x07, 0xa6, 0xdd, 0x62, 0xb4, 0xe2, 0xb2, 0x48, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, + 0xce, 0xcf, 0x85, 0x39, 0x51, 0x3f, 0x3d, 0x5f, 0x37, 0xb5, 0x22, 0x35, 0xb9, 0xb4, 0x24, 0x33, + 0x3f, 0x4f, 0x37, 0x31, 0x29, 0x39, 0x13, 0x6a, 0x45, 0x31, 0xb2, 0x27, 0x9c, 0x22, 0x4f, 0x3c, + 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, + 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x9e, 0x5c, 0x33, 0xa1, 0x62, 0x49, 0x6c, + 0x60, 0xbf, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x98, 0x4f, 0x8c, 0x77, 0x40, 0x01, 0x00, + 0x00, } func (m *Module) Marshal() (dAtA []byte, err error) { diff --git a/modules/sequencer/types/codec.go b/modules/rollkitmngr/types/codec.go similarity index 72% rename from modules/sequencer/types/codec.go rename to modules/rollkitmngr/types/codec.go index d94efe5..28b8d88 100644 --- a/modules/sequencer/types/codec.go +++ b/modules/rollkitmngr/types/codec.go @@ -9,13 +9,15 @@ import ( ) func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - legacy.RegisterAminoMsg(cdc, &MsgChangeSequencers{}, "sequencer/v1/MsgChangeSequencers") + legacy.RegisterAminoMsg(cdc, &MsgMigrateToRollkit{}, "rollkitmngr/v1/MsgMigrateToRollkit") + legacy.RegisterAminoMsg(cdc, &MsgEditAttesters{}, "rollkitmngr/v1/MsgEditAttesters") } // RegisterInterfaces registers the x/sequencer interfaces types with the interface registry func RegisterInterfaces(registry types.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgChangeSequencers{}, + &MsgMigrateToRollkit{}, + &MsgEditAttesters{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/modules/sequencer/types/expected_keepers.go b/modules/rollkitmngr/types/expected_keepers.go similarity index 62% rename from modules/sequencer/types/expected_keepers.go rename to modules/rollkitmngr/types/expected_keepers.go index 1d5b735..4019766 100644 --- a/modules/sequencer/types/expected_keepers.go +++ b/modules/rollkitmngr/types/expected_keepers.go @@ -3,21 +3,13 @@ package types import ( context "context" - "cosmossdk.io/core/address" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) -// AccountKeeper defines the expected account keeper. -type AccountKeeper interface { - AddressCodec() address.Codec - - GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx context.Context, moduleName string) sdk.ModuleAccountI -} - // StakingKeeper defines the expected staking keeper. type StakingKeeper interface { + GetValidatorByConsAddr(ctx context.Context, consAddr sdk.ConsAddress) (stakingtypes.Validator, error) GetLastValidators(ctx context.Context) (validators []stakingtypes.Validator, err error) IterateBondedValidatorsByPower(context.Context, func(index int64, validator stakingtypes.ValidatorI) (stop bool)) error } diff --git a/modules/rollkitmngr/types/keys.go b/modules/rollkitmngr/types/keys.go new file mode 100644 index 0000000..42d93b8 --- /dev/null +++ b/modules/rollkitmngr/types/keys.go @@ -0,0 +1,10 @@ +package types + +// ModuleName is the name of the rollkitmngr module +const ModuleName = "rollkitmngr" + +var ( + MigrationKey = []byte{0x13} + SequencerKey = []byte{0x14} + MigrationStepKey = []byte{0x15} +) diff --git a/modules/rollkitmngr/types/query.pb.go b/modules/rollkitmngr/types/query.pb.go new file mode 100644 index 0000000..1ed67d9 --- /dev/null +++ b/modules/rollkitmngr/types/query.pb.go @@ -0,0 +1,1286 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: rollkitsdk/rollkitmngr/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/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 + +// QueryIsMigratingRequest is request type for the Query/IsMigrating RPC method. +type QueryIsMigratingRequest struct { +} + +func (m *QueryIsMigratingRequest) Reset() { *m = QueryIsMigratingRequest{} } +func (m *QueryIsMigratingRequest) String() string { return proto.CompactTextString(m) } +func (*QueryIsMigratingRequest) ProtoMessage() {} +func (*QueryIsMigratingRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2ebbede1dda82d15, []int{0} +} +func (m *QueryIsMigratingRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryIsMigratingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryIsMigratingRequest.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 *QueryIsMigratingRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryIsMigratingRequest.Merge(m, src) +} +func (m *QueryIsMigratingRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryIsMigratingRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryIsMigratingRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryIsMigratingRequest proto.InternalMessageInfo + +// QueryIsMigratingResponse is response type for the Query/IsMigrating RPC method. +type QueryIsMigratingResponse struct { + // is_migrating indicates whether the chain is migrating to rollkit. + IsMigrating bool `protobuf:"varint,1,opt,name=is_migrating,json=isMigrating,proto3" json:"is_migrating,omitempty"` + // start_block_height is the block height at which the migration will start. + StartBlockHeight uint64 `protobuf:"varint,2,opt,name=start_block_height,json=startBlockHeight,proto3" json:"start_block_height,omitempty"` + // end_block_height is the block height at which the migration will end. + EndBlockHeight uint64 `protobuf:"varint,3,opt,name=end_block_height,json=endBlockHeight,proto3" json:"end_block_height,omitempty"` +} + +func (m *QueryIsMigratingResponse) Reset() { *m = QueryIsMigratingResponse{} } +func (m *QueryIsMigratingResponse) String() string { return proto.CompactTextString(m) } +func (*QueryIsMigratingResponse) ProtoMessage() {} +func (*QueryIsMigratingResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2ebbede1dda82d15, []int{1} +} +func (m *QueryIsMigratingResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryIsMigratingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryIsMigratingResponse.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 *QueryIsMigratingResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryIsMigratingResponse.Merge(m, src) +} +func (m *QueryIsMigratingResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryIsMigratingResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryIsMigratingResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryIsMigratingResponse proto.InternalMessageInfo + +func (m *QueryIsMigratingResponse) GetIsMigrating() bool { + if m != nil { + return m.IsMigrating + } + return false +} + +func (m *QueryIsMigratingResponse) GetStartBlockHeight() uint64 { + if m != nil { + return m.StartBlockHeight + } + return 0 +} + +func (m *QueryIsMigratingResponse) GetEndBlockHeight() uint64 { + if m != nil { + return m.EndBlockHeight + } + return 0 +} + +// QuerySequencerRequest is request type for the Query/Sequencer RPC method. +type QuerySequencerRequest struct { +} + +func (m *QuerySequencerRequest) Reset() { *m = QuerySequencerRequest{} } +func (m *QuerySequencerRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySequencerRequest) ProtoMessage() {} +func (*QuerySequencerRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2ebbede1dda82d15, []int{2} +} +func (m *QuerySequencerRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySequencerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySequencerRequest.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 *QuerySequencerRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySequencerRequest.Merge(m, src) +} +func (m *QuerySequencerRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySequencerRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySequencerRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySequencerRequest proto.InternalMessageInfo + +// QuerySequencerResponse is response type for the Query/Sequencer RPC method. +type QuerySequencerResponse struct { + // sequencer is the requested sequencer. + Sequencer Sequencer `protobuf:"bytes,1,opt,name=sequencer,proto3" json:"sequencer"` +} + +func (m *QuerySequencerResponse) Reset() { *m = QuerySequencerResponse{} } +func (m *QuerySequencerResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySequencerResponse) ProtoMessage() {} +func (*QuerySequencerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2ebbede1dda82d15, []int{3} +} +func (m *QuerySequencerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySequencerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySequencerResponse.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 *QuerySequencerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySequencerResponse.Merge(m, src) +} +func (m *QuerySequencerResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySequencerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySequencerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySequencerResponse proto.InternalMessageInfo + +func (m *QuerySequencerResponse) GetSequencer() Sequencer { + if m != nil { + return m.Sequencer + } + return Sequencer{} +} + +// QueryAttestersRequest is request type for the Query/Attesters RPC method. +type QueryAttestersRequest struct { +} + +func (m *QueryAttestersRequest) Reset() { *m = QueryAttestersRequest{} } +func (m *QueryAttestersRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAttestersRequest) ProtoMessage() {} +func (*QueryAttestersRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2ebbede1dda82d15, []int{4} +} +func (m *QueryAttestersRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAttestersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAttestersRequest.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 *QueryAttestersRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAttestersRequest.Merge(m, src) +} +func (m *QueryAttestersRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAttestersRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAttestersRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAttestersRequest proto.InternalMessageInfo + +// QueryAttestersResponse is response type for the Query/Attesters RPC method. +type QueryAttestersResponse struct { + // attesters is the list of attesters. + Attesters []Attester `protobuf:"bytes,1,rep,name=attesters,proto3" json:"attesters"` +} + +func (m *QueryAttestersResponse) Reset() { *m = QueryAttestersResponse{} } +func (m *QueryAttestersResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAttestersResponse) ProtoMessage() {} +func (*QueryAttestersResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2ebbede1dda82d15, []int{5} +} +func (m *QueryAttestersResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAttestersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAttestersResponse.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 *QueryAttestersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAttestersResponse.Merge(m, src) +} +func (m *QueryAttestersResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAttestersResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAttestersResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAttestersResponse proto.InternalMessageInfo + +func (m *QueryAttestersResponse) GetAttesters() []Attester { + if m != nil { + return m.Attesters + } + return nil +} + +func init() { + proto.RegisterType((*QueryIsMigratingRequest)(nil), "rollkitsdk.rollkitmngr.v1.QueryIsMigratingRequest") + proto.RegisterType((*QueryIsMigratingResponse)(nil), "rollkitsdk.rollkitmngr.v1.QueryIsMigratingResponse") + proto.RegisterType((*QuerySequencerRequest)(nil), "rollkitsdk.rollkitmngr.v1.QuerySequencerRequest") + proto.RegisterType((*QuerySequencerResponse)(nil), "rollkitsdk.rollkitmngr.v1.QuerySequencerResponse") + proto.RegisterType((*QueryAttestersRequest)(nil), "rollkitsdk.rollkitmngr.v1.QueryAttestersRequest") + proto.RegisterType((*QueryAttestersResponse)(nil), "rollkitsdk.rollkitmngr.v1.QueryAttestersResponse") +} + +func init() { + proto.RegisterFile("rollkitsdk/rollkitmngr/v1/query.proto", fileDescriptor_2ebbede1dda82d15) +} + +var fileDescriptor_2ebbede1dda82d15 = []byte{ + // 505 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x41, 0x6b, 0x13, 0x41, + 0x14, 0xc7, 0x33, 0x8d, 0x8a, 0x99, 0x88, 0xd4, 0x41, 0x6d, 0x1a, 0x64, 0x4d, 0xd3, 0x2a, 0x51, + 0xda, 0x5d, 0x93, 0xde, 0x05, 0x73, 0x52, 0xb0, 0x07, 0xe3, 0x45, 0xbc, 0x84, 0xc9, 0x66, 0x9c, + 0x0c, 0xd9, 0x9d, 0x49, 0x67, 0x66, 0x8b, 0xbd, 0xfa, 0x09, 0x04, 0xf1, 0xe4, 0xd5, 0x83, 0x47, + 0x3f, 0x46, 0x8f, 0x05, 0x2f, 0x9e, 0x44, 0x12, 0x41, 0xf0, 0x53, 0xc8, 0x4e, 0x67, 0x27, 0x9b, + 0x94, 0x24, 0xe4, 0x12, 0x86, 0xf7, 0xfe, 0xf3, 0x9f, 0x5f, 0xf6, 0xff, 0x78, 0xf0, 0x81, 0x14, + 0x51, 0x34, 0x64, 0x5a, 0xf5, 0x87, 0x81, 0x3d, 0xc6, 0x9c, 0xca, 0xe0, 0xa4, 0x19, 0x1c, 0x27, + 0x44, 0x9e, 0xfa, 0x23, 0x29, 0xb4, 0x40, 0xdb, 0x53, 0x99, 0x9f, 0x93, 0xf9, 0x27, 0xcd, 0xea, + 0x2d, 0x1c, 0x33, 0x2e, 0x02, 0xf3, 0x7b, 0xa1, 0xae, 0xde, 0xa6, 0x82, 0x0a, 0x73, 0x0c, 0xd2, + 0x93, 0xad, 0xde, 0xa3, 0x42, 0xd0, 0x88, 0x04, 0x78, 0xc4, 0x02, 0xcc, 0xb9, 0xd0, 0x58, 0x33, + 0xc1, 0x95, 0xed, 0x2e, 0x01, 0xd1, 0xa7, 0x23, 0x62, 0x65, 0xf5, 0x6d, 0xb8, 0xf5, 0x2a, 0xe5, + 0x7a, 0xa1, 0x8e, 0x18, 0x95, 0x58, 0x33, 0x4e, 0x3b, 0xe4, 0x38, 0x21, 0x4a, 0xd7, 0x3f, 0x03, + 0x58, 0xb9, 0xdc, 0x53, 0x23, 0xc1, 0x15, 0x41, 0x3b, 0xf0, 0x06, 0x53, 0xdd, 0x38, 0xab, 0x57, + 0x40, 0x0d, 0x34, 0xae, 0x77, 0xca, 0x6c, 0x2a, 0x45, 0xfb, 0x10, 0x29, 0x8d, 0xa5, 0xee, 0xf6, + 0x22, 0x11, 0x0e, 0xbb, 0x03, 0xc2, 0xe8, 0x40, 0x57, 0x36, 0x6a, 0xa0, 0x71, 0xa5, 0xb3, 0x69, + 0x3a, 0xed, 0xb4, 0xf1, 0xdc, 0xd4, 0x51, 0x03, 0x6e, 0x12, 0xde, 0x9f, 0xd5, 0x16, 0x8d, 0xf6, + 0x26, 0xe1, 0xfd, 0x9c, 0xb2, 0xbe, 0x05, 0xef, 0x18, 0xac, 0xd7, 0x29, 0x27, 0x0f, 0x89, 0xcc, + 0x80, 0x29, 0xbc, 0x3b, 0xdf, 0xb0, 0xb4, 0x47, 0xb0, 0xa4, 0xb2, 0xa2, 0x41, 0x2d, 0xb7, 0xf6, + 0xfc, 0x85, 0x11, 0xf8, 0xce, 0xa0, 0x5d, 0x3a, 0xfb, 0x75, 0xbf, 0xf0, 0xed, 0xef, 0xf7, 0xc7, + 0xa0, 0x33, 0x75, 0x70, 0x04, 0xcf, 0xb4, 0x26, 0x4a, 0x13, 0xa9, 0x32, 0x82, 0x77, 0x96, 0x20, + 0xd7, 0xb0, 0x04, 0x2f, 0x61, 0x09, 0x67, 0xc5, 0x0a, 0xa8, 0x15, 0x1b, 0xe5, 0xd6, 0xee, 0x12, + 0x82, 0xcc, 0x60, 0x06, 0xc0, 0x19, 0xb4, 0xfe, 0x15, 0xe1, 0x55, 0xf3, 0x10, 0xfa, 0x0a, 0x60, + 0x39, 0x97, 0x0f, 0x6a, 0x2d, 0x31, 0x5d, 0x10, 0x74, 0xf5, 0x70, 0xad, 0x3b, 0x17, 0x7f, 0xa8, + 0xbe, 0xff, 0xe1, 0xc7, 0x9f, 0x4f, 0x1b, 0x0f, 0xd1, 0x5e, 0x36, 0x5d, 0xf3, 0x53, 0x96, 0x1f, + 0x0f, 0xf4, 0x05, 0xc0, 0x92, 0xfb, 0xaa, 0xe8, 0xc9, 0xaa, 0x07, 0xe7, 0xa3, 0xad, 0x36, 0xd7, + 0xb8, 0x61, 0x01, 0x1f, 0x19, 0xc0, 0x5d, 0xb4, 0xb3, 0x08, 0xd0, 0xe5, 0x69, 0xe8, 0x5c, 0x64, + 0xab, 0xe9, 0xe6, 0x63, 0x5f, 0x4d, 0x77, 0x69, 0x1e, 0x56, 0xd3, 0xb9, 0xb0, 0xdb, 0x6f, 0xce, + 0xc6, 0x1e, 0x38, 0x1f, 0x7b, 0xe0, 0xf7, 0xd8, 0x03, 0x1f, 0x27, 0x5e, 0xe1, 0x7c, 0xe2, 0x15, + 0x7e, 0x4e, 0xbc, 0xc2, 0xdb, 0xa7, 0x94, 0xe9, 0x41, 0xd2, 0xf3, 0x43, 0x11, 0x3b, 0x1b, 0x2a, + 0x0e, 0xc8, 0x7b, 0x12, 0x26, 0xe9, 0x2e, 0x38, 0xc0, 0xbd, 0x90, 0x05, 0xb1, 0xe8, 0x27, 0x11, + 0x51, 0x33, 0x0f, 0x98, 0x15, 0xd0, 0xbb, 0x66, 0x76, 0xc0, 0xe1, 0xff, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xd1, 0x1f, 0xb0, 0x5d, 0xb5, 0x04, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // IsMigrating queries the sequencer changes. + IsMigrating(ctx context.Context, in *QueryIsMigratingRequest, opts ...grpc.CallOption) (*QueryIsMigratingResponse, error) + // Sequencer queries the sequencer. + Sequencer(ctx context.Context, in *QuerySequencerRequest, opts ...grpc.CallOption) (*QuerySequencerResponse, error) + // Attesters queries the list of attesters. + Attesters(ctx context.Context, in *QueryAttestersRequest, opts ...grpc.CallOption) (*QueryAttestersResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) IsMigrating(ctx context.Context, in *QueryIsMigratingRequest, opts ...grpc.CallOption) (*QueryIsMigratingResponse, error) { + out := new(QueryIsMigratingResponse) + err := c.cc.Invoke(ctx, "/rollkitsdk.rollkitmngr.v1.Query/IsMigrating", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Sequencer(ctx context.Context, in *QuerySequencerRequest, opts ...grpc.CallOption) (*QuerySequencerResponse, error) { + out := new(QuerySequencerResponse) + err := c.cc.Invoke(ctx, "/rollkitsdk.rollkitmngr.v1.Query/Sequencer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Attesters(ctx context.Context, in *QueryAttestersRequest, opts ...grpc.CallOption) (*QueryAttestersResponse, error) { + out := new(QueryAttestersResponse) + err := c.cc.Invoke(ctx, "/rollkitsdk.rollkitmngr.v1.Query/Attesters", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // IsMigrating queries the sequencer changes. + IsMigrating(context.Context, *QueryIsMigratingRequest) (*QueryIsMigratingResponse, error) + // Sequencer queries the sequencer. + Sequencer(context.Context, *QuerySequencerRequest) (*QuerySequencerResponse, error) + // Attesters queries the list of attesters. + Attesters(context.Context, *QueryAttestersRequest) (*QueryAttestersResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) IsMigrating(ctx context.Context, req *QueryIsMigratingRequest) (*QueryIsMigratingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method IsMigrating not implemented") +} +func (*UnimplementedQueryServer) Sequencer(ctx context.Context, req *QuerySequencerRequest) (*QuerySequencerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Sequencer not implemented") +} +func (*UnimplementedQueryServer) Attesters(ctx context.Context, req *QueryAttestersRequest) (*QueryAttestersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Attesters not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_IsMigrating_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryIsMigratingRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).IsMigrating(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rollkitsdk.rollkitmngr.v1.Query/IsMigrating", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).IsMigrating(ctx, req.(*QueryIsMigratingRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Sequencer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySequencerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Sequencer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rollkitsdk.rollkitmngr.v1.Query/Sequencer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Sequencer(ctx, req.(*QuerySequencerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Attesters_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAttestersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Attesters(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rollkitsdk.rollkitmngr.v1.Query/Attesters", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Attesters(ctx, req.(*QueryAttestersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var Query_serviceDesc = _Query_serviceDesc +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "rollkitsdk.rollkitmngr.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "IsMigrating", + Handler: _Query_IsMigrating_Handler, + }, + { + MethodName: "Sequencer", + Handler: _Query_Sequencer_Handler, + }, + { + MethodName: "Attesters", + Handler: _Query_Attesters_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "rollkitsdk/rollkitmngr/v1/query.proto", +} + +func (m *QueryIsMigratingRequest) 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 *QueryIsMigratingRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryIsMigratingRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryIsMigratingResponse) 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 *QueryIsMigratingResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryIsMigratingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.EndBlockHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.EndBlockHeight)) + i-- + dAtA[i] = 0x18 + } + if m.StartBlockHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.StartBlockHeight)) + i-- + dAtA[i] = 0x10 + } + if m.IsMigrating { + i-- + if m.IsMigrating { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QuerySequencerRequest) 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 *QuerySequencerRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySequencerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QuerySequencerResponse) 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 *QuerySequencerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySequencerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Sequencer.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 *QueryAttestersRequest) 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 *QueryAttestersRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAttestersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryAttestersResponse) 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 *QueryAttestersResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAttestersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Attesters) > 0 { + for iNdEx := len(m.Attesters) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Attesters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryIsMigratingRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryIsMigratingResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.IsMigrating { + n += 2 + } + if m.StartBlockHeight != 0 { + n += 1 + sovQuery(uint64(m.StartBlockHeight)) + } + if m.EndBlockHeight != 0 { + n += 1 + sovQuery(uint64(m.EndBlockHeight)) + } + return n +} + +func (m *QuerySequencerRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QuerySequencerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Sequencer.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryAttestersRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryAttestersResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Attesters) > 0 { + for _, e := range m.Attesters { + l = e.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 *QueryIsMigratingRequest) 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: QueryIsMigratingRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryIsMigratingRequest: 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 *QueryIsMigratingResponse) 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: QueryIsMigratingResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryIsMigratingResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsMigrating", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsMigrating = bool(v != 0) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartBlockHeight", wireType) + } + m.StartBlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartBlockHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EndBlockHeight", wireType) + } + m.EndBlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EndBlockHeight |= 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 *QuerySequencerRequest) 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: QuerySequencerRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySequencerRequest: 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 *QuerySequencerResponse) 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: QuerySequencerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySequencerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequencer", 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.Sequencer.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 *QueryAttestersRequest) 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: QueryAttestersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAttestersRequest: 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 *QueryAttestersResponse) 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: QueryAttestersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAttestersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attesters", 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.Attesters = append(m.Attesters, Attester{}) + if err := m.Attesters[len(m.Attesters)-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 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/modules/rollkitmngr/types/query.pb.gw.go b/modules/rollkitmngr/types/query.pb.gw.go new file mode 100644 index 0000000..77e9f30 --- /dev/null +++ b/modules/rollkitmngr/types/query.pb.gw.go @@ -0,0 +1,283 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: rollkitsdk/rollkitmngr/v1/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_IsMigrating_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryIsMigratingRequest + var metadata runtime.ServerMetadata + + msg, err := client.IsMigrating(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_IsMigrating_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryIsMigratingRequest + var metadata runtime.ServerMetadata + + msg, err := server.IsMigrating(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Sequencer_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySequencerRequest + var metadata runtime.ServerMetadata + + msg, err := client.Sequencer(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Sequencer_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySequencerRequest + var metadata runtime.ServerMetadata + + msg, err := server.Sequencer(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Attesters_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAttestersRequest + var metadata runtime.ServerMetadata + + msg, err := client.Attesters(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Attesters_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAttestersRequest + var metadata runtime.ServerMetadata + + msg, err := server.Attesters(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_IsMigrating_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_IsMigrating_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_IsMigrating_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Sequencer_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_Sequencer_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_Sequencer_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Attesters_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_Attesters_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_Attesters_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_IsMigrating_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_IsMigrating_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_IsMigrating_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Sequencer_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_Sequencer_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_Sequencer_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Attesters_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_Attesters_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_Attesters_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_IsMigrating_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"rollkit", "rollkitmngr", "v1", "is_migrating"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Sequencer_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"rollkit", "rollkitmngr", "v1", "sequencer"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Attesters_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"rollkit", "rollkitmngr", "v1", "attesters"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_IsMigrating_0 = runtime.ForwardResponseMessage + + forward_Query_Sequencer_0 = runtime.ForwardResponseMessage + + forward_Query_Attesters_0 = runtime.ForwardResponseMessage +) diff --git a/modules/sequencer/types/sequencer.go b/modules/rollkitmngr/types/sequencer.go similarity index 54% rename from modules/sequencer/types/sequencer.go rename to modules/rollkitmngr/types/sequencer.go index b6f1763..cf8d6ac 100644 --- a/modules/sequencer/types/sequencer.go +++ b/modules/rollkitmngr/types/sequencer.go @@ -9,6 +9,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) +// TmConsPublicKey converts the Sequencer's consensus public key to a CometBFT public key. func (seq Sequencer) TmConsPublicKey() (cmtprotocrypto.PublicKey, error) { pk, ok := seq.ConsensusPubkey.GetCachedValue().(cryptotypes.PubKey) if !ok { @@ -27,3 +28,23 @@ func (seq Sequencer) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { var pk cryptotypes.PubKey return unpacker.UnpackAny(seq.ConsensusPubkey, &pk) } + +// TmConsPublicKey converts the Sequencer's ConsensusPubkey to a CometBFT PublicKey type. +func (att Attester) TmConsPublicKey() (cmtprotocrypto.PublicKey, error) { + pk, ok := att.ConsensusPubkey.GetCachedValue().(cryptotypes.PubKey) + if !ok { + return cmtprotocrypto.PublicKey{}, errors.Wrapf(sdkerrors.ErrInvalidType, "expecting cryptotypes.PubKey, got %T", pk) + } + + tmPk, err := cryptocodec.ToCmtProtoPublicKey(pk) + if err != nil { + return cmtprotocrypto.PublicKey{}, err + } + return tmPk, nil +} + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (att Attester) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + var pk cryptotypes.PubKey + return unpacker.UnpackAny(att.ConsensusPubkey, &pk) +} diff --git a/modules/rollkitmngr/types/tx.pb.go b/modules/rollkitmngr/types/tx.pb.go new file mode 100644 index 0000000..4de5dfe --- /dev/null +++ b/modules/rollkitmngr/types/tx.pb.go @@ -0,0 +1,1103 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: rollkitsdk/rollkitmngr/v1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/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 + +// MsgMigrateToRollkit is the Msg/MsgMigrateToRollkit request type. +type MsgMigrateToRollkit struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // block height that trigger the rollkit migration. + // When IBC is enabled, the migration can take several blocks to complete. + // This is the block height at which the migration will be triggered. + BlockHeight uint64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` + // sequencer is the pubkey that will become new sequencer. + Sequencer Sequencer `protobuf:"bytes,3,opt,name=sequencer,proto3" json:"sequencer"` + // attesters is the list of attesters that will attest to blocks. + Attesters []Attester `protobuf:"bytes,4,rep,name=attesters,proto3" json:"attesters"` +} + +func (m *MsgMigrateToRollkit) Reset() { *m = MsgMigrateToRollkit{} } +func (m *MsgMigrateToRollkit) String() string { return proto.CompactTextString(m) } +func (*MsgMigrateToRollkit) ProtoMessage() {} +func (*MsgMigrateToRollkit) Descriptor() ([]byte, []int) { + return fileDescriptor_43700acb817b0d03, []int{0} +} +func (m *MsgMigrateToRollkit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMigrateToRollkit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMigrateToRollkit.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 *MsgMigrateToRollkit) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMigrateToRollkit.Merge(m, src) +} +func (m *MsgMigrateToRollkit) XXX_Size() int { + return m.Size() +} +func (m *MsgMigrateToRollkit) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMigrateToRollkit.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMigrateToRollkit proto.InternalMessageInfo + +func (m *MsgMigrateToRollkit) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgMigrateToRollkit) GetBlockHeight() uint64 { + if m != nil { + return m.BlockHeight + } + return 0 +} + +func (m *MsgMigrateToRollkit) GetSequencer() Sequencer { + if m != nil { + return m.Sequencer + } + return Sequencer{} +} + +func (m *MsgMigrateToRollkit) GetAttesters() []Attester { + if m != nil { + return m.Attesters + } + return nil +} + +// MsgMigrateToRollkitResponse defines the response structure for executing a +// MsgRollkitMigrate message. +type MsgMigrateToRollkitResponse struct { +} + +func (m *MsgMigrateToRollkitResponse) Reset() { *m = MsgMigrateToRollkitResponse{} } +func (m *MsgMigrateToRollkitResponse) String() string { return proto.CompactTextString(m) } +func (*MsgMigrateToRollkitResponse) ProtoMessage() {} +func (*MsgMigrateToRollkitResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_43700acb817b0d03, []int{1} +} +func (m *MsgMigrateToRollkitResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMigrateToRollkitResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMigrateToRollkitResponse.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 *MsgMigrateToRollkitResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMigrateToRollkitResponse.Merge(m, src) +} +func (m *MsgMigrateToRollkitResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgMigrateToRollkitResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMigrateToRollkitResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMigrateToRollkitResponse proto.InternalMessageInfo + +// MsgEditAttesters is the Msg/EditAttesters request type. +type MsgEditAttesters struct { + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // attesters is the list of attesters to add or remove. + Attesters []Attester `protobuf:"bytes,2,rep,name=attesters,proto3" json:"attesters"` +} + +func (m *MsgEditAttesters) Reset() { *m = MsgEditAttesters{} } +func (m *MsgEditAttesters) String() string { return proto.CompactTextString(m) } +func (*MsgEditAttesters) ProtoMessage() {} +func (*MsgEditAttesters) Descriptor() ([]byte, []int) { + return fileDescriptor_43700acb817b0d03, []int{2} +} +func (m *MsgEditAttesters) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEditAttesters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEditAttesters.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 *MsgEditAttesters) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEditAttesters.Merge(m, src) +} +func (m *MsgEditAttesters) XXX_Size() int { + return m.Size() +} +func (m *MsgEditAttesters) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEditAttesters.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEditAttesters proto.InternalMessageInfo + +func (m *MsgEditAttesters) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgEditAttesters) GetAttesters() []Attester { + if m != nil { + return m.Attesters + } + return nil +} + +// MsgEditAttestersResponse defines the response structure for executing a +// MsgEditAttesters message. +type MsgEditAttestersResponse struct { +} + +func (m *MsgEditAttestersResponse) Reset() { *m = MsgEditAttestersResponse{} } +func (m *MsgEditAttestersResponse) String() string { return proto.CompactTextString(m) } +func (*MsgEditAttestersResponse) ProtoMessage() {} +func (*MsgEditAttestersResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_43700acb817b0d03, []int{3} +} +func (m *MsgEditAttestersResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEditAttestersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEditAttestersResponse.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 *MsgEditAttestersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEditAttestersResponse.Merge(m, src) +} +func (m *MsgEditAttestersResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgEditAttestersResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEditAttestersResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEditAttestersResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgMigrateToRollkit)(nil), "rollkitsdk.rollkitmngr.v1.MsgMigrateToRollkit") + proto.RegisterType((*MsgMigrateToRollkitResponse)(nil), "rollkitsdk.rollkitmngr.v1.MsgMigrateToRollkitResponse") + proto.RegisterType((*MsgEditAttesters)(nil), "rollkitsdk.rollkitmngr.v1.MsgEditAttesters") + proto.RegisterType((*MsgEditAttestersResponse)(nil), "rollkitsdk.rollkitmngr.v1.MsgEditAttestersResponse") +} + +func init() { + proto.RegisterFile("rollkitsdk/rollkitmngr/v1/tx.proto", fileDescriptor_43700acb817b0d03) +} + +var fileDescriptor_43700acb817b0d03 = []byte{ + // 494 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0xbf, 0x6f, 0xd3, 0x40, + 0x14, 0xce, 0x25, 0x05, 0xc9, 0x17, 0x90, 0x8a, 0xa9, 0x84, 0x6b, 0x84, 0x1b, 0x0c, 0x48, 0x51, + 0x50, 0x6c, 0x35, 0x15, 0x1d, 0x18, 0x90, 0x1a, 0x09, 0x89, 0x01, 0x2f, 0x2e, 0x03, 0x62, 0xa9, + 0x1c, 0xfb, 0x74, 0x39, 0x25, 0xf6, 0xa5, 0xf7, 0xce, 0x55, 0xcb, 0x84, 0x18, 0x99, 0xf8, 0x33, + 0x18, 0x33, 0xf0, 0x27, 0x30, 0x74, 0x60, 0xa8, 0x98, 0x98, 0x10, 0x4a, 0x86, 0xfc, 0x11, 0x2c, + 0x28, 0xfe, 0x41, 0x70, 0x13, 0x2c, 0x85, 0x2e, 0xd6, 0xdd, 0xf7, 0x3e, 0x7f, 0xef, 0x7d, 0x9f, + 0xee, 0x61, 0x53, 0xf0, 0xe1, 0x70, 0xc0, 0x24, 0x04, 0x03, 0x3b, 0x3b, 0x86, 0x11, 0x15, 0xf6, + 0xc9, 0xae, 0x2d, 0x4f, 0xad, 0x91, 0xe0, 0x92, 0xab, 0xdb, 0x0b, 0x8e, 0xf5, 0x17, 0xc7, 0x3a, + 0xd9, 0xd5, 0x6f, 0x79, 0x21, 0x8b, 0xb8, 0x9d, 0x7c, 0x53, 0xb6, 0x7e, 0xc7, 0xe7, 0x10, 0x72, + 0xb0, 0x43, 0xa0, 0x73, 0x95, 0x10, 0x68, 0x56, 0xd8, 0x4e, 0x0b, 0x47, 0xc9, 0xcd, 0x4e, 0x2f, + 0x59, 0x69, 0x8b, 0x72, 0xca, 0x53, 0x7c, 0x7e, 0xca, 0xd0, 0x47, 0x25, 0xb3, 0x9d, 0x8d, 0x48, + 0xf6, 0xb3, 0xf9, 0xa5, 0x8a, 0x6f, 0x3b, 0x40, 0x1d, 0x46, 0x85, 0x27, 0xc9, 0x2b, 0xee, 0xa6, + 0x54, 0x75, 0x1f, 0x2b, 0x5e, 0x2c, 0xfb, 0x5c, 0x30, 0x79, 0xa6, 0xa1, 0x06, 0x6a, 0x2a, 0x5d, + 0xed, 0xdb, 0xe7, 0xf6, 0x56, 0xd6, 0xf9, 0x20, 0x08, 0x04, 0x01, 0x38, 0x94, 0x82, 0x45, 0xd4, + 0x5d, 0x50, 0xd5, 0xfb, 0xf8, 0x46, 0x6f, 0xc8, 0xfd, 0xc1, 0x51, 0x9f, 0x30, 0xda, 0x97, 0x5a, + 0xb5, 0x81, 0x9a, 0x1b, 0x6e, 0x3d, 0xc1, 0x5e, 0x24, 0x90, 0xea, 0x60, 0x05, 0xc8, 0x71, 0x4c, + 0x22, 0x9f, 0x08, 0xad, 0xd6, 0x40, 0xcd, 0x7a, 0xe7, 0xa1, 0xf5, 0xcf, 0x94, 0xac, 0xc3, 0x9c, + 0xdb, 0x55, 0xce, 0x7f, 0xec, 0x54, 0x3e, 0xcd, 0xc6, 0x2d, 0xe4, 0x2e, 0x14, 0xd4, 0x97, 0x58, + 0xf1, 0xa4, 0x24, 0x20, 0x89, 0x00, 0x6d, 0xa3, 0x51, 0x6b, 0xd6, 0x3b, 0x0f, 0x4a, 0xe4, 0x0e, + 0x32, 0x6e, 0x41, 0xed, 0x8f, 0xc0, 0xd3, 0x27, 0xef, 0x67, 0xe3, 0xd6, 0xc2, 0xcf, 0x87, 0xd9, + 0xb8, 0x65, 0x5e, 0x8a, 0x6f, 0x45, 0x5c, 0xe6, 0x3d, 0x7c, 0x77, 0x05, 0xec, 0x12, 0x18, 0xf1, + 0x08, 0x88, 0xf9, 0x15, 0xe1, 0x4d, 0x07, 0xe8, 0xf3, 0x80, 0xc9, 0xbc, 0x3f, 0xfc, 0x77, 0xc4, + 0x05, 0xc3, 0xd5, 0xab, 0x1a, 0xee, 0x2c, 0x1b, 0xde, 0x59, 0x36, 0x5c, 0x98, 0xdc, 0xd4, 0xb1, + 0x76, 0x19, 0xcb, 0xad, 0x76, 0x7e, 0x21, 0x5c, 0x73, 0x80, 0xaa, 0x6f, 0xf1, 0xe6, 0xd2, 0xa3, + 0xb2, 0x4a, 0xc6, 0x5c, 0x11, 0x9f, 0xbe, 0xbf, 0x1e, 0x3f, 0x9f, 0x41, 0x3d, 0xc6, 0x37, 0x8b, + 0x51, 0x3f, 0x2e, 0x17, 0x2a, 0x90, 0xf5, 0xbd, 0x35, 0xc8, 0x79, 0x4b, 0xfd, 0xda, 0xbb, 0x79, + 0xb0, 0xdd, 0xd7, 0xe7, 0x13, 0x03, 0x5d, 0x4c, 0x0c, 0xf4, 0x73, 0x62, 0xa0, 0x8f, 0x53, 0xa3, + 0x72, 0x31, 0x35, 0x2a, 0xdf, 0xa7, 0x46, 0xe5, 0xcd, 0x33, 0xca, 0x64, 0x3f, 0xee, 0x59, 0x3e, + 0x0f, 0xf3, 0x7d, 0xb4, 0x29, 0x6f, 0x93, 0x53, 0xe2, 0xc7, 0x92, 0xf1, 0xa8, 0xed, 0xf5, 0x7c, + 0x66, 0x87, 0x3c, 0x88, 0x87, 0x04, 0x0a, 0x1b, 0x9b, 0xac, 0x6b, 0xef, 0x7a, 0xb2, 0xaf, 0x7b, + 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xaf, 0xdd, 0x78, 0xaa, 0x74, 0x04, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// 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 { + // MigrateToRollkit defines a (governance) operation for the migration to rollkit. The authority defaults to the x/gov module account. + MigrateToRollkit(ctx context.Context, in *MsgMigrateToRollkit, opts ...grpc.CallOption) (*MsgMigrateToRollkitResponse, error) + // EditAttesters defines a governance operation to edit the list of attesters. + EditAttesters(ctx context.Context, in *MsgEditAttesters, opts ...grpc.CallOption) (*MsgEditAttestersResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) MigrateToRollkit(ctx context.Context, in *MsgMigrateToRollkit, opts ...grpc.CallOption) (*MsgMigrateToRollkitResponse, error) { + out := new(MsgMigrateToRollkitResponse) + err := c.cc.Invoke(ctx, "/rollkitsdk.rollkitmngr.v1.Msg/MigrateToRollkit", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) EditAttesters(ctx context.Context, in *MsgEditAttesters, opts ...grpc.CallOption) (*MsgEditAttestersResponse, error) { + out := new(MsgEditAttestersResponse) + err := c.cc.Invoke(ctx, "/rollkitsdk.rollkitmngr.v1.Msg/EditAttesters", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // MigrateToRollkit defines a (governance) operation for the migration to rollkit. The authority defaults to the x/gov module account. + MigrateToRollkit(context.Context, *MsgMigrateToRollkit) (*MsgMigrateToRollkitResponse, error) + // EditAttesters defines a governance operation to edit the list of attesters. + EditAttesters(context.Context, *MsgEditAttesters) (*MsgEditAttestersResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) MigrateToRollkit(ctx context.Context, req *MsgMigrateToRollkit) (*MsgMigrateToRollkitResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MigrateToRollkit not implemented") +} +func (*UnimplementedMsgServer) EditAttesters(ctx context.Context, req *MsgEditAttesters) (*MsgEditAttestersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EditAttesters not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_MigrateToRollkit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgMigrateToRollkit) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).MigrateToRollkit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rollkitsdk.rollkitmngr.v1.Msg/MigrateToRollkit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).MigrateToRollkit(ctx, req.(*MsgMigrateToRollkit)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_EditAttesters_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgEditAttesters) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).EditAttesters(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rollkitsdk.rollkitmngr.v1.Msg/EditAttesters", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).EditAttesters(ctx, req.(*MsgEditAttesters)) + } + return interceptor(ctx, in, info, handler) +} + +var Msg_serviceDesc = _Msg_serviceDesc +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "rollkitsdk.rollkitmngr.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "MigrateToRollkit", + Handler: _Msg_MigrateToRollkit_Handler, + }, + { + MethodName: "EditAttesters", + Handler: _Msg_EditAttesters_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "rollkitsdk/rollkitmngr/v1/tx.proto", +} + +func (m *MsgMigrateToRollkit) 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 *MsgMigrateToRollkit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMigrateToRollkit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Attesters) > 0 { + for iNdEx := len(m.Attesters) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Attesters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + { + size, err := m.Sequencer.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.BlockHeight != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.BlockHeight)) + i-- + dAtA[i] = 0x10 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgMigrateToRollkitResponse) 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 *MsgMigrateToRollkitResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMigrateToRollkitResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgEditAttesters) 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 *MsgEditAttesters) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEditAttesters) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Attesters) > 0 { + for iNdEx := len(m.Attesters) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Attesters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgEditAttestersResponse) 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 *MsgEditAttestersResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEditAttestersResponse) 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 *MsgMigrateToRollkit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.BlockHeight != 0 { + n += 1 + sovTx(uint64(m.BlockHeight)) + } + l = m.Sequencer.Size() + n += 1 + l + sovTx(uint64(l)) + if len(m.Attesters) > 0 { + for _, e := range m.Attesters { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgMigrateToRollkitResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgEditAttesters) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Attesters) > 0 { + for _, e := range m.Attesters { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgEditAttestersResponse) 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 *MsgMigrateToRollkit) 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: MsgMigrateToRollkit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMigrateToRollkit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) + } + m.BlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequencer", 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 err := m.Sequencer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attesters", 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 + } + m.Attesters = append(m.Attesters, Attester{}) + if err := m.Attesters[len(m.Attesters)-1].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 *MsgMigrateToRollkitResponse) 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: MsgMigrateToRollkitResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMigrateToRollkitResponse: 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 (m *MsgEditAttesters) 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: MsgEditAttesters: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEditAttesters: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attesters", 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 + } + m.Attesters = append(m.Attesters, Attester{}) + if err := m.Attesters[len(m.Attesters)-1].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 *MsgEditAttestersResponse) 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: MsgEditAttestersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEditAttestersResponse: 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") +) diff --git a/modules/rollkitmngr/types/types.pb.go b/modules/rollkitmngr/types/types.pb.go new file mode 100644 index 0000000..0326ebb --- /dev/null +++ b/modules/rollkitmngr/types/types.pb.go @@ -0,0 +1,909 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: rollkitsdk/rollkitmngr/v1/types.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/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 + +// RollkitMigration defines the migration state from cometbft to rollkit. +type RollkitMigration struct { + // block height that trigger the rollkit migration. + // When IBC is enabled, the migration can take several blocks to complete. + // This is the block height at which the migration will be triggered. + BlockHeight uint64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` + // sequencer is the pubkey that will become new sequencer. + Sequencer Sequencer `protobuf:"bytes,3,opt,name=sequencer,proto3" json:"sequencer"` + // attesters is the list of attesters that will attest to blocks. + Attesters []Attester `protobuf:"bytes,4,rep,name=attesters,proto3" json:"attesters"` +} + +func (m *RollkitMigration) Reset() { *m = RollkitMigration{} } +func (m *RollkitMigration) String() string { return proto.CompactTextString(m) } +func (*RollkitMigration) ProtoMessage() {} +func (*RollkitMigration) Descriptor() ([]byte, []int) { + return fileDescriptor_7aa7ce538eeba3ee, []int{0} +} +func (m *RollkitMigration) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RollkitMigration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RollkitMigration.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 *RollkitMigration) XXX_Merge(src proto.Message) { + xxx_messageInfo_RollkitMigration.Merge(m, src) +} +func (m *RollkitMigration) XXX_Size() int { + return m.Size() +} +func (m *RollkitMigration) XXX_DiscardUnknown() { + xxx_messageInfo_RollkitMigration.DiscardUnknown(m) +} + +var xxx_messageInfo_RollkitMigration proto.InternalMessageInfo + +func (m *RollkitMigration) GetBlockHeight() uint64 { + if m != nil { + return m.BlockHeight + } + return 0 +} + +func (m *RollkitMigration) GetSequencer() Sequencer { + if m != nil { + return m.Sequencer + } + return Sequencer{} +} + +func (m *RollkitMigration) GetAttesters() []Attester { + if m != nil { + return m.Attesters + } + return nil +} + +// Sequencer defines a sequence of instructions to be executed. +type Sequencer struct { + // name is the human-readable name of the sequencer. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // consensus_pubkey is the consensus public key of the sequencer, as a + // Protobuf Any. + ConsensusPubkey *types.Any `protobuf:"bytes,2,opt,name=consensus_pubkey,json=consensusPubkey,proto3" json:"consensus_pubkey,omitempty"` +} + +func (m *Sequencer) Reset() { *m = Sequencer{} } +func (m *Sequencer) String() string { return proto.CompactTextString(m) } +func (*Sequencer) ProtoMessage() {} +func (*Sequencer) Descriptor() ([]byte, []int) { + return fileDescriptor_7aa7ce538eeba3ee, []int{1} +} +func (m *Sequencer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Sequencer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Sequencer.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 *Sequencer) XXX_Merge(src proto.Message) { + xxx_messageInfo_Sequencer.Merge(m, src) +} +func (m *Sequencer) XXX_Size() int { + return m.Size() +} +func (m *Sequencer) XXX_DiscardUnknown() { + xxx_messageInfo_Sequencer.DiscardUnknown(m) +} + +var xxx_messageInfo_Sequencer proto.InternalMessageInfo + +func (m *Sequencer) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Sequencer) GetConsensusPubkey() *types.Any { + if m != nil { + return m.ConsensusPubkey + } + return nil +} + +// Attester defines an attester that can attest to blocks. +type Attester struct { + // name is the human-readable name of the attester. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // consensus_pubkey is the consensus public key of the attester, as a + // Protobuf Any. + ConsensusPubkey *types.Any `protobuf:"bytes,2,opt,name=consensus_pubkey,json=consensusPubkey,proto3" json:"consensus_pubkey,omitempty"` +} + +func (m *Attester) Reset() { *m = Attester{} } +func (m *Attester) String() string { return proto.CompactTextString(m) } +func (*Attester) ProtoMessage() {} +func (*Attester) Descriptor() ([]byte, []int) { + return fileDescriptor_7aa7ce538eeba3ee, []int{2} +} +func (m *Attester) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Attester) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Attester.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 *Attester) XXX_Merge(src proto.Message) { + xxx_messageInfo_Attester.Merge(m, src) +} +func (m *Attester) XXX_Size() int { + return m.Size() +} +func (m *Attester) XXX_DiscardUnknown() { + xxx_messageInfo_Attester.DiscardUnknown(m) +} + +var xxx_messageInfo_Attester proto.InternalMessageInfo + +func (m *Attester) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Attester) GetConsensusPubkey() *types.Any { + if m != nil { + return m.ConsensusPubkey + } + return nil +} + +func init() { + proto.RegisterType((*RollkitMigration)(nil), "rollkitsdk.rollkitmngr.v1.RollkitMigration") + proto.RegisterType((*Sequencer)(nil), "rollkitsdk.rollkitmngr.v1.Sequencer") + proto.RegisterType((*Attester)(nil), "rollkitsdk.rollkitmngr.v1.Attester") +} + +func init() { + proto.RegisterFile("rollkitsdk/rollkitmngr/v1/types.proto", fileDescriptor_7aa7ce538eeba3ee) +} + +var fileDescriptor_7aa7ce538eeba3ee = []byte{ + // 409 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x52, 0x3f, 0x8b, 0xd4, 0x40, + 0x14, 0xcf, 0x78, 0x8b, 0x98, 0x89, 0xe0, 0x19, 0xb6, 0xc8, 0x5d, 0x11, 0xe3, 0xaa, 0x10, 0x84, + 0x9d, 0xe1, 0xd6, 0x5e, 0xb8, 0xad, 0x04, 0x3d, 0x38, 0x62, 0xa3, 0x36, 0x4b, 0x32, 0x37, 0xce, + 0x86, 0x24, 0xf3, 0x62, 0x66, 0xe6, 0x30, 0x7e, 0x0a, 0x3f, 0x86, 0xa5, 0x85, 0x1f, 0xe2, 0xb0, + 0x3a, 0xac, 0xac, 0x44, 0x76, 0x0b, 0xbf, 0x86, 0xec, 0x24, 0xd9, 0x75, 0x0b, 0x2d, 0x6d, 0x86, + 0xdf, 0x7b, 0xef, 0xc7, 0xef, 0xfd, 0x99, 0x1f, 0x7e, 0xd4, 0x40, 0x59, 0x16, 0xb9, 0x56, 0x17, + 0x05, 0xed, 0x61, 0x25, 0x45, 0x43, 0x2f, 0x4f, 0xa8, 0x6e, 0x6b, 0xae, 0x48, 0xdd, 0x80, 0x06, + 0xff, 0x68, 0x47, 0x23, 0x7f, 0xd0, 0xc8, 0xe5, 0xc9, 0xf1, 0xdd, 0xb4, 0xca, 0x25, 0x50, 0xfb, + 0x76, 0xec, 0xe3, 0xb1, 0x00, 0x01, 0x16, 0xd2, 0x0d, 0xea, 0xb3, 0x47, 0x0c, 0x54, 0x05, 0x6a, + 0xd1, 0x15, 0xba, 0x60, 0x28, 0x09, 0x00, 0x51, 0x72, 0x6a, 0xa3, 0xcc, 0xbc, 0xa5, 0xa9, 0x6c, + 0xbb, 0xd2, 0xe4, 0x1b, 0xc2, 0x87, 0x49, 0xd7, 0xf1, 0x2c, 0x17, 0x4d, 0xaa, 0x73, 0x90, 0xfe, + 0x7d, 0x7c, 0x3b, 0x2b, 0x81, 0x15, 0x8b, 0x25, 0xcf, 0xc5, 0x52, 0x07, 0x37, 0x22, 0x14, 0x8f, + 0x12, 0xcf, 0xe6, 0x9e, 0xd9, 0x94, 0x7f, 0x86, 0x5d, 0xc5, 0xdf, 0x19, 0x2e, 0x19, 0x6f, 0x82, + 0x83, 0x08, 0xc5, 0xde, 0xec, 0x21, 0xf9, 0xeb, 0x16, 0xe4, 0xe5, 0xc0, 0x9d, 0xbb, 0x57, 0x3f, + 0xee, 0x39, 0x9f, 0x7e, 0x7d, 0x7e, 0x8c, 0x92, 0x9d, 0x82, 0xff, 0x02, 0xbb, 0xa9, 0xd6, 0x5c, + 0x69, 0xde, 0xa8, 0x60, 0x14, 0x1d, 0xc4, 0xde, 0xec, 0xc1, 0x3f, 0xe4, 0x4e, 0x7b, 0xee, 0x9e, + 0xda, 0x56, 0x60, 0xf2, 0x01, 0xbb, 0xdb, 0x86, 0xbe, 0x8f, 0x47, 0x32, 0xad, 0x78, 0x80, 0x22, + 0x14, 0xbb, 0x89, 0xc5, 0xfe, 0x6b, 0x7c, 0xc8, 0x40, 0x2a, 0x2e, 0x95, 0x51, 0x8b, 0xda, 0x64, + 0x05, 0x6f, 0xed, 0x92, 0xde, 0x6c, 0x4c, 0xba, 0x5b, 0x91, 0xe1, 0x56, 0xe4, 0x54, 0xb6, 0xf3, + 0xe0, 0xeb, 0x97, 0xe9, 0xb8, 0x3f, 0x29, 0x6b, 0xda, 0x5a, 0x03, 0x39, 0x37, 0xd9, 0x73, 0xde, + 0x26, 0x77, 0xb6, 0x3a, 0xe7, 0x56, 0x66, 0xd2, 0xe2, 0x5b, 0xc3, 0x74, 0xff, 0xb9, 0xf5, 0xfc, + 0xd5, 0xd5, 0x2a, 0x44, 0xd7, 0xab, 0x10, 0xfd, 0x5c, 0x85, 0xe8, 0xe3, 0x3a, 0x74, 0xae, 0xd7, + 0xa1, 0xf3, 0x7d, 0x1d, 0x3a, 0x6f, 0x9e, 0x8a, 0x5c, 0x2f, 0x4d, 0x46, 0x18, 0x54, 0x83, 0x0d, + 0xa9, 0x80, 0x29, 0x7f, 0xcf, 0x99, 0xd9, 0xfc, 0xf8, 0x34, 0xcd, 0x58, 0x4e, 0x2b, 0xb8, 0x30, + 0x25, 0x57, 0x7b, 0x46, 0xb5, 0x2e, 0xcd, 0x6e, 0xda, 0x91, 0x9e, 0xfc, 0x0e, 0x00, 0x00, 0xff, + 0xff, 0x6e, 0xb9, 0x38, 0xd9, 0xcf, 0x02, 0x00, 0x00, +} + +func (m *RollkitMigration) 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 *RollkitMigration) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RollkitMigration) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Attesters) > 0 { + for iNdEx := len(m.Attesters) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Attesters[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + { + size, err := m.Sequencer.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.BlockHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.BlockHeight)) + i-- + dAtA[i] = 0x10 + } + return len(dAtA) - i, nil +} + +func (m *Sequencer) 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 *Sequencer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Sequencer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ConsensusPubkey != nil { + { + size, err := m.ConsensusPubkey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Attester) 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 *Attester) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Attester) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ConsensusPubkey != nil { + { + size, err := m.ConsensusPubkey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *RollkitMigration) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BlockHeight != 0 { + n += 1 + sovTypes(uint64(m.BlockHeight)) + } + l = m.Sequencer.Size() + n += 1 + l + sovTypes(uint64(l)) + if len(m.Attesters) > 0 { + for _, e := range m.Attesters { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *Sequencer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.ConsensusPubkey != nil { + l = m.ConsensusPubkey.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *Attester) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.ConsensusPubkey != nil { + l = m.ConsensusPubkey.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *RollkitMigration) 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 ErrIntOverflowTypes + } + 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: RollkitMigration: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RollkitMigration: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) + } + m.BlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequencer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Sequencer.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attesters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Attesters = append(m.Attesters, Attester{}) + if err := m.Attesters[len(m.Attesters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Sequencer) 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 ErrIntOverflowTypes + } + 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: Sequencer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Sequencer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsensusPubkey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ConsensusPubkey == nil { + m.ConsensusPubkey = &types.Any{} + } + if err := m.ConsensusPubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Attester) 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 ErrIntOverflowTypes + } + 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: Attester: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Attester: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsensusPubkey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ConsensusPubkey == nil { + m.ConsensusPubkey = &types.Any{} + } + if err := m.ConsensusPubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(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, ErrIntOverflowTypes + } + 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, ErrIntOverflowTypes + } + 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, ErrIntOverflowTypes + } + 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, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/modules/sequencer/keeper/abci.go b/modules/sequencer/keeper/abci.go deleted file mode 100644 index 1472809..0000000 --- a/modules/sequencer/keeper/abci.go +++ /dev/null @@ -1,29 +0,0 @@ -package keeper - -import ( - "context" - "errors" - - "cosmossdk.io/collections" - abci "github.com/cometbft/cometbft/abci/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// EndBlocker is called at the end of every block and returns sequencer updates. -func (k Keeper) EndBlock(ctx context.Context) ([]abci.ValidatorUpdate, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - nextSequencer, err := k.NextSequencers.Get(sdkCtx, uint64(sdkCtx.BlockHeight())) - if errors.Is(err, collections.ErrNotFound) { - // no sequencer change scheduled for this block - return []abci.ValidatorUpdate{}, nil - } else if err != nil { - return nil, err - } - - validatorSet, err := k.stakingKeeper.GetLastValidators(sdkCtx) - if err != nil { - return nil, err - } - - return k.MigrateToSequencer(sdkCtx, nextSequencer, validatorSet) -} diff --git a/modules/sequencer/keeper/grpc_query.go b/modules/sequencer/keeper/grpc_query.go deleted file mode 100644 index 290cc2e..0000000 --- a/modules/sequencer/keeper/grpc_query.go +++ /dev/null @@ -1,69 +0,0 @@ -package keeper - -import ( - "context" - "errors" - - "cosmossdk.io/collections" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/rollkit/go-execution-abci/modules/sequencer/types" -) - -var _ types.QueryServer = queryServer{} - -type queryServer struct { - Keeper -} - -// NewQueryServer creates a new instance of the sequencer query server. -func NewQueryServer(keeper Keeper) types.QueryServer { - return queryServer{Keeper: keeper} -} - -// Sequencers returns the current sequencers. -// Note it is only a wrapper around the staking module's query. -func (q queryServer) Sequencers(ctx context.Context, _ *types.QuerySequencersRequest) (*types.QuerySequencersResponse, error) { - vals, err := q.stakingKeeper.GetLastValidators(ctx) - if err != nil { - return nil, sdkerrors.ErrLogic.Wrapf("failed to get last validators") - } - - // Eventually, refactor this when rollkit suppots multiple sequencers. - // In the meantime, this is enough to determine if the chain is using rollkit or not. - // There is one false positive for single validators chains, but those are more often local testnets. - if len(vals) > 1 { - return nil, sdkerrors.ErrLogic.Wrapf("chain is currently not using Rollkit") - } - - sequencers := make([]types.Sequencer, len(vals)) - for i, val := range vals { - sequencers[i] = types.Sequencer{ - Name: val.GetMoniker(), - ConsensusPubkey: val.ConsensusPubkey, - } - } - - return &types.QuerySequencersResponse{ - Sequencers: sequencers, - }, nil -} - -// SequencersChanges returns the planned sequencers changes. -func (q queryServer) SequencersChanges(ctx context.Context, _ *types.QuerySequencersChangesRequest) (*types.QuerySequencersChangesResponse, error) { - var sequencers []types.SequencerChanges - err := q.NextSequencers.Walk(ctx, nil, func(key uint64, sequencer types.Sequencer) (bool, error) { - sequencers = append(sequencers, types.SequencerChanges{ - BlockHeight: key, - Sequencers: []types.Sequencer{sequencer}, - }) - return false, nil - }) - if err != nil && !errors.Is(err, collections.ErrNotFound) { - return nil, err - } - - return &types.QuerySequencersChangesResponse{ - SequencerChanges: sequencers, - }, nil -} diff --git a/modules/sequencer/keeper/keeper.go b/modules/sequencer/keeper/keeper.go deleted file mode 100644 index 98aedda..0000000 --- a/modules/sequencer/keeper/keeper.go +++ /dev/null @@ -1,66 +0,0 @@ -package keeper - -import ( - "cosmossdk.io/collections" - storetypes "cosmossdk.io/core/store" - "cosmossdk.io/log" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/rollkit/go-execution-abci/modules/sequencer/types" -) - -type Keeper struct { - storeService storetypes.KVStoreService - cdc codec.BinaryCodec - authority string - - authKeeper types.AccountKeeper - stakingKeeper types.StakingKeeper - - Schema collections.Schema - NextSequencers collections.Map[uint64, types.Sequencer] -} - -// NewKeeper creates a new sequencer Keeper instance. -func NewKeeper( - cdc codec.BinaryCodec, - storeService storetypes.KVStoreService, - ak types.AccountKeeper, - stakingKeeper types.StakingKeeper, - authority string, -) Keeper { - // ensure that authority is a valid account address - if _, err := ak.AddressCodec().StringToBytes(authority); err != nil { - panic("authority is not a valid acc address") - } - - sb := collections.NewSchemaBuilder(storeService) - k := Keeper{ - storeService: storeService, - cdc: cdc, - authority: authority, - authKeeper: ak, - stakingKeeper: stakingKeeper, - NextSequencers: collections.NewMap( - sb, - types.NextSequencersKey, - "next_sequencers", - collections.Uint64Key, - codec.CollValue[types.Sequencer](cdc), - ), - } - - schema, err := sb.Build() - if err != nil { - panic(err) - } - k.Schema = schema - - return k -} - -// Logger returns a module-specific logger. -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", "x/"+types.ModuleName) -} diff --git a/modules/sequencer/keeper/migration.go b/modules/sequencer/keeper/migration.go deleted file mode 100644 index c340232..0000000 --- a/modules/sequencer/keeper/migration.go +++ /dev/null @@ -1,43 +0,0 @@ -package keeper - -import ( - abci "github.com/cometbft/cometbft/abci/types" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - "github.com/rollkit/go-execution-abci/modules/sequencer/types" -) - -// MigrateToSequencer includes the logic that needs to execute during the process of a CometBFT chain to rollup changeover **or** a sequencer changeover. -// This method constructs validator updates that will be given to CometBFT, that will gradually (TODO) remove all the validators and add the sequencer. -func (k Keeper) MigrateToSequencer(ctx sdk.Context, nextSeq types.Sequencer, lastValidatorSet []stakingtypes.Validator) (initialValUpdates []abci.ValidatorUpdate, err error) { - pk, err := nextSeq.TmConsPublicKey() - if err != nil { - return nil, err - } - sequencerUpdate := abci.ValidatorUpdate{ - PubKey: pk, - Power: 1, - } - - for _, val := range lastValidatorSet { - powerUpdate := val.ABCIValidatorUpdateZero() - if val.ConsensusPubkey.Equal(nextSeq.ConsensusPubkey) { - continue - } - initialValUpdates = append(initialValUpdates, powerUpdate) - } - - if len(lastValidatorSet) > 1 { - k.Logger(ctx).Info("Migration to single sequencer complete. Chain is now using Rollkit.") - } else { - k.Logger(ctx).Info("Sequencer change complete. Chain is now using the new sequencer.") - } - - // remove the sequencer from the next sequencer map - if err = k.NextSequencers.Remove(ctx, uint64(ctx.BlockHeight())); err != nil { - return nil, err - } - - return append(initialValUpdates, sequencerUpdate), nil -} diff --git a/modules/sequencer/keeper/msg_server.go b/modules/sequencer/keeper/msg_server.go deleted file mode 100644 index a742937..0000000 --- a/modules/sequencer/keeper/msg_server.go +++ /dev/null @@ -1,47 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - - "github.com/rollkit/go-execution-abci/modules/sequencer/types" -) - -var _ types.MsgServer = msgServer{} - -type msgServer struct { - Keeper -} - -// NewMsgServerImpl returns an implementation of sequencer MsgServer interface. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: keeper} -} - -func (k msgServer) ChangeSequencers(ctx context.Context, msg *types.MsgChangeSequencers) (*types.MsgChangeSequencersResponse, error) { - if k.authority != msg.Authority { - return nil, govtypes.ErrInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.authority, msg.Authority) - } - - if len(msg.Sequencers) == 0 { - return nil, sdkerrors.ErrNotSupported.Wrapf("a sequencer is required.") - } - - if len(msg.Sequencers) > 1 { - return nil, sdkerrors.ErrNotSupported.Wrapf("currently only one sequencer can be set at a time") - } - - sdkCtx := sdk.UnwrapSDKContext(ctx) - if msg.BlockHeight < uint64(sdkCtx.BlockHeight()) { - return nil, sdkerrors.ErrInvalidRequest.Wrapf("block height %d must be greater than current block height %d", msg.BlockHeight, sdkCtx.BlockHeight()) - } - - if err := k.NextSequencers.Set(ctx, msg.BlockHeight, msg.Sequencers[0]); err != nil { - return nil, err - } - - return &types.MsgChangeSequencersResponse{}, nil -} diff --git a/modules/sequencer/types/keys.go b/modules/sequencer/types/keys.go deleted file mode 100644 index c9303df..0000000 --- a/modules/sequencer/types/keys.go +++ /dev/null @@ -1,9 +0,0 @@ -package types - -// ModuleName is the name of the sequencer module -const ModuleName = "sequencer" - -var ( - SequencerConsAddrKey = []byte{0x11} - NextSequencersKey = []byte{0x13} -) diff --git a/modules/sequencer/types/query.pb.go b/modules/sequencer/types/query.pb.go deleted file mode 100644 index d06ae9f..0000000 --- a/modules/sequencer/types/query.pb.go +++ /dev/null @@ -1,896 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: rollkitsdk/sequencer/v1/query.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/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 - -// QuerySequencersChangesRequest is request type for the Query/SequencersChanges RPC method. -type QuerySequencersChangesRequest struct { -} - -func (m *QuerySequencersChangesRequest) Reset() { *m = QuerySequencersChangesRequest{} } -func (m *QuerySequencersChangesRequest) String() string { return proto.CompactTextString(m) } -func (*QuerySequencersChangesRequest) ProtoMessage() {} -func (*QuerySequencersChangesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8891a1048a0af2d9, []int{0} -} -func (m *QuerySequencersChangesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QuerySequencersChangesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QuerySequencersChangesRequest.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 *QuerySequencersChangesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySequencersChangesRequest.Merge(m, src) -} -func (m *QuerySequencersChangesRequest) XXX_Size() int { - return m.Size() -} -func (m *QuerySequencersChangesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySequencersChangesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QuerySequencersChangesRequest proto.InternalMessageInfo - -// QuerySequencersChangesResponse is response type for the Query/SequencersChanges RPC method. -type QuerySequencersChangesResponse struct { - // sequencer_changes is the list of sequencer changes. - SequencerChanges []SequencerChanges `protobuf:"bytes,1,rep,name=sequencer_changes,json=sequencerChanges,proto3" json:"sequencer_changes"` -} - -func (m *QuerySequencersChangesResponse) Reset() { *m = QuerySequencersChangesResponse{} } -func (m *QuerySequencersChangesResponse) String() string { return proto.CompactTextString(m) } -func (*QuerySequencersChangesResponse) ProtoMessage() {} -func (*QuerySequencersChangesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_8891a1048a0af2d9, []int{1} -} -func (m *QuerySequencersChangesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QuerySequencersChangesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QuerySequencersChangesResponse.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 *QuerySequencersChangesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySequencersChangesResponse.Merge(m, src) -} -func (m *QuerySequencersChangesResponse) XXX_Size() int { - return m.Size() -} -func (m *QuerySequencersChangesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySequencersChangesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QuerySequencersChangesResponse proto.InternalMessageInfo - -func (m *QuerySequencersChangesResponse) GetSequencerChanges() []SequencerChanges { - if m != nil { - return m.SequencerChanges - } - return nil -} - -// QuerySequencersRequest is request type for the Query/Sequencers RPC method. -type QuerySequencersRequest struct { -} - -func (m *QuerySequencersRequest) Reset() { *m = QuerySequencersRequest{} } -func (m *QuerySequencersRequest) String() string { return proto.CompactTextString(m) } -func (*QuerySequencersRequest) ProtoMessage() {} -func (*QuerySequencersRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8891a1048a0af2d9, []int{2} -} -func (m *QuerySequencersRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QuerySequencersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QuerySequencersRequest.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 *QuerySequencersRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySequencersRequest.Merge(m, src) -} -func (m *QuerySequencersRequest) XXX_Size() int { - return m.Size() -} -func (m *QuerySequencersRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySequencersRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QuerySequencersRequest proto.InternalMessageInfo - -// QuerySequencersResponse is response type for the Query/Sequencers RPC method. -type QuerySequencersResponse struct { - // sequencers is the list of sequencers. - Sequencers []Sequencer `protobuf:"bytes,1,rep,name=sequencers,proto3" json:"sequencers"` -} - -func (m *QuerySequencersResponse) Reset() { *m = QuerySequencersResponse{} } -func (m *QuerySequencersResponse) String() string { return proto.CompactTextString(m) } -func (*QuerySequencersResponse) ProtoMessage() {} -func (*QuerySequencersResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_8891a1048a0af2d9, []int{3} -} -func (m *QuerySequencersResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QuerySequencersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QuerySequencersResponse.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 *QuerySequencersResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySequencersResponse.Merge(m, src) -} -func (m *QuerySequencersResponse) XXX_Size() int { - return m.Size() -} -func (m *QuerySequencersResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySequencersResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QuerySequencersResponse proto.InternalMessageInfo - -func (m *QuerySequencersResponse) GetSequencers() []Sequencer { - if m != nil { - return m.Sequencers - } - return nil -} - -func init() { - proto.RegisterType((*QuerySequencersChangesRequest)(nil), "rollkitsdk.sequencer.v1.QuerySequencersChangesRequest") - proto.RegisterType((*QuerySequencersChangesResponse)(nil), "rollkitsdk.sequencer.v1.QuerySequencersChangesResponse") - proto.RegisterType((*QuerySequencersRequest)(nil), "rollkitsdk.sequencer.v1.QuerySequencersRequest") - proto.RegisterType((*QuerySequencersResponse)(nil), "rollkitsdk.sequencer.v1.QuerySequencersResponse") -} - -func init() { - proto.RegisterFile("rollkitsdk/sequencer/v1/query.proto", fileDescriptor_8891a1048a0af2d9) -} - -var fileDescriptor_8891a1048a0af2d9 = []byte{ - // 392 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2e, 0xca, 0xcf, 0xc9, - 0xc9, 0xce, 0x2c, 0x29, 0x4e, 0xc9, 0xd6, 0x2f, 0x4e, 0x2d, 0x2c, 0x4d, 0xcd, 0x4b, 0x4e, 0x2d, - 0xd2, 0x2f, 0x33, 0xd4, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, - 0x12, 0x47, 0x28, 0xd2, 0x83, 0x2b, 0xd2, 0x2b, 0x33, 0x94, 0x12, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, - 0xd7, 0x07, 0x93, 0x10, 0xb5, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0xa6, 0x3e, 0x88, 0x05, - 0x15, 0x95, 0x49, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x4f, 0x2c, 0xc8, 0xd4, 0x4f, 0xcc, 0xcb, - 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, 0xcf, 0x2b, 0x86, 0xca, 0xe2, 0x74, 0x44, 0x49, 0x65, 0x41, - 0x2a, 0x54, 0x91, 0x92, 0x3c, 0x97, 0x6c, 0x20, 0xc8, 0x4d, 0xc1, 0x30, 0x05, 0xc5, 0xce, 0x19, - 0x89, 0x79, 0xe9, 0xa9, 0xc5, 0x41, 0x20, 0x81, 0xe2, 0x12, 0xa5, 0x66, 0x46, 0x2e, 0x39, 0x5c, - 0x2a, 0x8a, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x85, 0x12, 0xb9, 0x04, 0xe1, 0xe6, 0xc7, 0x27, 0x43, - 0x24, 0x25, 0x18, 0x15, 0x98, 0x35, 0xb8, 0x8d, 0x34, 0xf5, 0x70, 0x78, 0x52, 0x0f, 0x6e, 0x1c, - 0xd4, 0x34, 0x27, 0xce, 0x13, 0xf7, 0xe4, 0x19, 0x56, 0x3c, 0xdf, 0xa0, 0xc5, 0x18, 0x24, 0x50, - 0x8c, 0x26, 0xa9, 0x24, 0xc1, 0x25, 0x86, 0xe6, 0x08, 0x98, 0xfb, 0x32, 0xb8, 0xc4, 0x31, 0x64, - 0xa0, 0xee, 0xf2, 0xe5, 0xe2, 0x82, 0x1b, 0x04, 0x73, 0x90, 0x12, 0x61, 0x07, 0x21, 0xbb, 0x04, - 0xc9, 0x00, 0xa3, 0x3b, 0x4c, 0x5c, 0xac, 0x60, 0xab, 0x84, 0xb6, 0x31, 0x72, 0x09, 0x62, 0x04, - 0x87, 0x90, 0x19, 0x4e, 0xa3, 0xf1, 0x86, 0xb0, 0x94, 0x39, 0xc9, 0xfa, 0x20, 0xfe, 0x53, 0x32, - 0x68, 0xba, 0xfc, 0x64, 0x32, 0x93, 0x96, 0x90, 0x86, 0x3e, 0xd4, 0x00, 0xd4, 0x68, 0x46, 0x38, - 0x1d, 0x16, 0x29, 0x42, 0x33, 0x19, 0xb9, 0xb8, 0x10, 0xe6, 0x09, 0xe9, 0x13, 0x6b, 0x33, 0xcc, - 0xa9, 0x06, 0xc4, 0x6b, 0x80, 0xba, 0x51, 0x03, 0xec, 0x46, 0x25, 0x21, 0x05, 0x42, 0x6e, 0x74, - 0x0a, 0x3b, 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, 0x9b, 0xf4, 0xcc, 0x92, - 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xb8, 0x29, 0xe9, 0xf9, 0xba, 0xa9, 0x15, 0xa9, 0xc9, - 0xa5, 0xa0, 0x04, 0xaf, 0x9b, 0x98, 0x94, 0x9c, 0xa9, 0x9f, 0x9b, 0x9f, 0x52, 0x9a, 0x93, 0x5a, - 0x8c, 0x64, 0x3e, 0x38, 0x9d, 0x27, 0xb1, 0x81, 0x13, 0xba, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, - 0x11, 0x21, 0x6d, 0xa3, 0x94, 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 { - // SequencersChanges queries the sequencer changes. - SequencersChanges(ctx context.Context, in *QuerySequencersChangesRequest, opts ...grpc.CallOption) (*QuerySequencersChangesResponse, error) - // Sequencers queries the sequencer. - Sequencers(ctx context.Context, in *QuerySequencersRequest, opts ...grpc.CallOption) (*QuerySequencersResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) SequencersChanges(ctx context.Context, in *QuerySequencersChangesRequest, opts ...grpc.CallOption) (*QuerySequencersChangesResponse, error) { - out := new(QuerySequencersChangesResponse) - err := c.cc.Invoke(ctx, "/rollkitsdk.sequencer.v1.Query/SequencersChanges", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Sequencers(ctx context.Context, in *QuerySequencersRequest, opts ...grpc.CallOption) (*QuerySequencersResponse, error) { - out := new(QuerySequencersResponse) - err := c.cc.Invoke(ctx, "/rollkitsdk.sequencer.v1.Query/Sequencers", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // SequencersChanges queries the sequencer changes. - SequencersChanges(context.Context, *QuerySequencersChangesRequest) (*QuerySequencersChangesResponse, error) - // Sequencers queries the sequencer. - Sequencers(context.Context, *QuerySequencersRequest) (*QuerySequencersResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) SequencersChanges(ctx context.Context, req *QuerySequencersChangesRequest) (*QuerySequencersChangesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SequencersChanges not implemented") -} -func (*UnimplementedQueryServer) Sequencers(ctx context.Context, req *QuerySequencersRequest) (*QuerySequencersResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Sequencers not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_SequencersChanges_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QuerySequencersChangesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).SequencersChanges(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rollkitsdk.sequencer.v1.Query/SequencersChanges", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).SequencersChanges(ctx, req.(*QuerySequencersChangesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Sequencers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QuerySequencersRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Sequencers(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rollkitsdk.sequencer.v1.Query/Sequencers", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Sequencers(ctx, req.(*QuerySequencersRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var Query_serviceDesc = _Query_serviceDesc -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "rollkitsdk.sequencer.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "SequencersChanges", - Handler: _Query_SequencersChanges_Handler, - }, - { - MethodName: "Sequencers", - Handler: _Query_Sequencers_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "rollkitsdk/sequencer/v1/query.proto", -} - -func (m *QuerySequencersChangesRequest) 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 *QuerySequencersChangesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QuerySequencersChangesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QuerySequencersChangesResponse) 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 *QuerySequencersChangesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QuerySequencersChangesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.SequencerChanges) > 0 { - for iNdEx := len(m.SequencerChanges) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.SequencerChanges[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 *QuerySequencersRequest) 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 *QuerySequencersRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QuerySequencersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QuerySequencersResponse) 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 *QuerySequencersResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QuerySequencersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Sequencers) > 0 { - for iNdEx := len(m.Sequencers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Sequencers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QuerySequencersChangesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QuerySequencersChangesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.SequencerChanges) > 0 { - for _, e := range m.SequencerChanges { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QuerySequencersRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QuerySequencersResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Sequencers) > 0 { - for _, e := range m.Sequencers { - l = e.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 *QuerySequencersChangesRequest) 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: QuerySequencersChangesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySequencersChangesRequest: 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 *QuerySequencersChangesResponse) 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: QuerySequencersChangesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySequencersChangesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SequencerChanges", 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.SequencerChanges = append(m.SequencerChanges, SequencerChanges{}) - if err := m.SequencerChanges[len(m.SequencerChanges)-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 *QuerySequencersRequest) 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: QuerySequencersRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySequencersRequest: 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 *QuerySequencersResponse) 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: QuerySequencersResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySequencersResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sequencers", 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.Sequencers = append(m.Sequencers, Sequencer{}) - if err := m.Sequencers[len(m.Sequencers)-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 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/modules/sequencer/types/query.pb.gw.go b/modules/sequencer/types/query.pb.gw.go deleted file mode 100644 index b6c8df9..0000000 --- a/modules/sequencer/types/query.pb.gw.go +++ /dev/null @@ -1,218 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: rollkitsdk/sequencer/v1/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_SequencersChanges_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QuerySequencersChangesRequest - var metadata runtime.ServerMetadata - - msg, err := client.SequencersChanges(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_SequencersChanges_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QuerySequencersChangesRequest - var metadata runtime.ServerMetadata - - msg, err := server.SequencersChanges(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_Sequencers_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QuerySequencersRequest - var metadata runtime.ServerMetadata - - msg, err := client.Sequencers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Sequencers_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QuerySequencersRequest - var metadata runtime.ServerMetadata - - msg, err := server.Sequencers(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_SequencersChanges_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_SequencersChanges_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_SequencersChanges_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Sequencers_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_Sequencers_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_Sequencers_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_SequencersChanges_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_SequencersChanges_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_SequencersChanges_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Sequencers_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_Sequencers_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_Sequencers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_SequencersChanges_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"rollkit", "sequencer", "v1", "sequencers_changes"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Sequencers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"rollkit", "sequencer", "v1", "sequencers"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_SequencersChanges_0 = runtime.ForwardResponseMessage - - forward_Query_Sequencers_0 = runtime.ForwardResponseMessage -) diff --git a/modules/sequencer/types/tx.pb.go b/modules/sequencer/types/tx.pb.go deleted file mode 100644 index cb91525..0000000 --- a/modules/sequencer/types/tx.pb.go +++ /dev/null @@ -1,646 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: rollkitsdk/sequencer/v1/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/types/msgservice" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/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 - -// MsgChangeSequencer is the Msg/ChangeSequencer request type. -type MsgChangeSequencers struct { - // authority is the address that controls the module (defaults to x/gov unless - // overwritten). - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // block height that trigger the change sequencer - BlockHeight uint64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` - // sequencers is the list pubkey that will become new sequencers. - Sequencers []Sequencer `protobuf:"bytes,3,rep,name=sequencers,proto3" json:"sequencers"` -} - -func (m *MsgChangeSequencers) Reset() { *m = MsgChangeSequencers{} } -func (m *MsgChangeSequencers) String() string { return proto.CompactTextString(m) } -func (*MsgChangeSequencers) ProtoMessage() {} -func (*MsgChangeSequencers) Descriptor() ([]byte, []int) { - return fileDescriptor_7443174feaeb5793, []int{0} -} -func (m *MsgChangeSequencers) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgChangeSequencers) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgChangeSequencers.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 *MsgChangeSequencers) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgChangeSequencers.Merge(m, src) -} -func (m *MsgChangeSequencers) XXX_Size() int { - return m.Size() -} -func (m *MsgChangeSequencers) XXX_DiscardUnknown() { - xxx_messageInfo_MsgChangeSequencers.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgChangeSequencers proto.InternalMessageInfo - -func (m *MsgChangeSequencers) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -func (m *MsgChangeSequencers) GetBlockHeight() uint64 { - if m != nil { - return m.BlockHeight - } - return 0 -} - -func (m *MsgChangeSequencers) GetSequencers() []Sequencer { - if m != nil { - return m.Sequencers - } - return nil -} - -// MsgChangeSequencerResponse defines the response structure for executing a -// MsgChangeSequencer message. -type MsgChangeSequencersResponse struct { -} - -func (m *MsgChangeSequencersResponse) Reset() { *m = MsgChangeSequencersResponse{} } -func (m *MsgChangeSequencersResponse) String() string { return proto.CompactTextString(m) } -func (*MsgChangeSequencersResponse) ProtoMessage() {} -func (*MsgChangeSequencersResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7443174feaeb5793, []int{1} -} -func (m *MsgChangeSequencersResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgChangeSequencersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgChangeSequencersResponse.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 *MsgChangeSequencersResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgChangeSequencersResponse.Merge(m, src) -} -func (m *MsgChangeSequencersResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgChangeSequencersResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgChangeSequencersResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgChangeSequencersResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgChangeSequencers)(nil), "rollkitsdk.sequencer.v1.MsgChangeSequencers") - proto.RegisterType((*MsgChangeSequencersResponse)(nil), "rollkitsdk.sequencer.v1.MsgChangeSequencersResponse") -} - -func init() { proto.RegisterFile("rollkitsdk/sequencer/v1/tx.proto", fileDescriptor_7443174feaeb5793) } - -var fileDescriptor_7443174feaeb5793 = []byte{ - // 399 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x28, 0xca, 0xcf, 0xc9, - 0xc9, 0xce, 0x2c, 0x29, 0x4e, 0xc9, 0xd6, 0x2f, 0x4e, 0x2d, 0x2c, 0x4d, 0xcd, 0x4b, 0x4e, 0x2d, - 0xd2, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x47, 0xa8, - 0xd0, 0x83, 0xab, 0xd0, 0x2b, 0x33, 0x94, 0x12, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, 0xd7, 0x07, 0x93, - 0x10, 0xb5, 0x52, 0xe2, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xfa, 0xb9, 0xc5, 0xe9, 0x20, 0x33, - 0x72, 0x8b, 0xd3, 0xa1, 0x12, 0x92, 0x10, 0x89, 0x78, 0x30, 0x4f, 0x1f, 0xc2, 0x81, 0x4a, 0x89, - 0xa4, 0xe7, 0xa7, 0xe7, 0x43, 0xc4, 0x41, 0x2c, 0xa8, 0xa8, 0x32, 0x4e, 0x77, 0x55, 0x16, 0xa4, - 0x42, 0xb5, 0x2a, 0x7d, 0x61, 0xe4, 0x12, 0xf6, 0x2d, 0x4e, 0x77, 0xce, 0x48, 0xcc, 0x4b, 0x4f, - 0x0d, 0x86, 0xa9, 0x2a, 0x16, 0x32, 0xe3, 0xe2, 0x4c, 0x2c, 0x2d, 0xc9, 0xc8, 0x2f, 0xca, 0x2c, - 0xa9, 0x94, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x74, 0x92, 0xb8, 0xb4, 0x45, 0x57, 0x04, 0x6a, 0xaf, - 0x63, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0x71, 0x70, 0x49, 0x51, 0x66, 0x5e, 0x7a, 0x10, 0x42, 0xa9, - 0x90, 0x22, 0x17, 0x4f, 0x52, 0x4e, 0x7e, 0x72, 0x76, 0x7c, 0x46, 0x6a, 0x66, 0x7a, 0x46, 0x89, - 0x04, 0x93, 0x02, 0xa3, 0x06, 0x4b, 0x10, 0x37, 0x58, 0xcc, 0x03, 0x2c, 0x24, 0xe4, 0xcb, 0xc5, - 0x05, 0x77, 0x4e, 0xb1, 0x04, 0xb3, 0x02, 0xb3, 0x06, 0xb7, 0x91, 0x92, 0x1e, 0x8e, 0x20, 0xd2, - 0x83, 0xbb, 0xc9, 0x89, 0xf3, 0xc4, 0x3d, 0x79, 0x86, 0x15, 0xcf, 0x37, 0x68, 0x31, 0x06, 0x21, - 0x19, 0x60, 0x65, 0xdc, 0xf4, 0x7c, 0x83, 0x16, 0xc2, 0x05, 0x5d, 0xcf, 0x37, 0x68, 0x29, 0xa0, - 0x78, 0x17, 0x8b, 0xf7, 0x94, 0x64, 0xb9, 0xa4, 0xb1, 0x08, 0x07, 0xa5, 0x16, 0x17, 0xe4, 0xe7, - 0x15, 0xa7, 0x1a, 0xb5, 0x30, 0x72, 0x31, 0xfb, 0x16, 0xa7, 0x0b, 0x95, 0x71, 0x09, 0x60, 0x84, - 0x8c, 0x0e, 0x4e, 0xa7, 0x62, 0x31, 0x51, 0xca, 0x84, 0x14, 0xd5, 0x30, 0xfb, 0xa5, 0x58, 0x1b, - 0x40, 0xde, 0x74, 0x0a, 0x3b, 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, 0x9b, - 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0xa8, 0x05, 0xfa, 0xe9, 0xf9, - 0xba, 0xa9, 0x15, 0xa9, 0xc9, 0xa5, 0x25, 0x99, 0xf9, 0x79, 0xba, 0x89, 0x49, 0xc9, 0x99, 0xfa, - 0xb9, 0xf9, 0x29, 0xa5, 0x39, 0xa9, 0xc5, 0x48, 0xb1, 0x0f, 0x8e, 0xfa, 0x24, 0x36, 0x70, 0xdc, - 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x3d, 0x6c, 0xe3, 0x9d, 0xba, 0x02, 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 { - // ChangeSequencers defines a (governance) operation for changing the - // sequencers. The authority defaults to the x/gov module account. - ChangeSequencers(ctx context.Context, in *MsgChangeSequencers, opts ...grpc.CallOption) (*MsgChangeSequencersResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) ChangeSequencers(ctx context.Context, in *MsgChangeSequencers, opts ...grpc.CallOption) (*MsgChangeSequencersResponse, error) { - out := new(MsgChangeSequencersResponse) - err := c.cc.Invoke(ctx, "/rollkitsdk.sequencer.v1.Msg/ChangeSequencers", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - // ChangeSequencers defines a (governance) operation for changing the - // sequencers. The authority defaults to the x/gov module account. - ChangeSequencers(context.Context, *MsgChangeSequencers) (*MsgChangeSequencersResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) ChangeSequencers(ctx context.Context, req *MsgChangeSequencers) (*MsgChangeSequencersResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ChangeSequencers not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_ChangeSequencers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgChangeSequencers) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).ChangeSequencers(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/rollkitsdk.sequencer.v1.Msg/ChangeSequencers", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).ChangeSequencers(ctx, req.(*MsgChangeSequencers)) - } - return interceptor(ctx, in, info, handler) -} - -var Msg_serviceDesc = _Msg_serviceDesc -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "rollkitsdk.sequencer.v1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ChangeSequencers", - Handler: _Msg_ChangeSequencers_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "rollkitsdk/sequencer/v1/tx.proto", -} - -func (m *MsgChangeSequencers) 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 *MsgChangeSequencers) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgChangeSequencers) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Sequencers) > 0 { - for iNdEx := len(m.Sequencers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Sequencers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if m.BlockHeight != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.BlockHeight)) - i-- - dAtA[i] = 0x10 - } - if len(m.Authority) > 0 { - i -= len(m.Authority) - copy(dAtA[i:], m.Authority) - i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgChangeSequencersResponse) 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 *MsgChangeSequencersResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgChangeSequencersResponse) 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 *MsgChangeSequencers) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.BlockHeight != 0 { - n += 1 + sovTx(uint64(m.BlockHeight)) - } - if len(m.Sequencers) > 0 { - for _, e := range m.Sequencers { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgChangeSequencersResponse) 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 *MsgChangeSequencers) 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: MsgChangeSequencers: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgChangeSequencers: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) - } - m.BlockHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlockHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sequencers", 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 - } - m.Sequencers = append(m.Sequencers, Sequencer{}) - if err := m.Sequencers[len(m.Sequencers)-1].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 *MsgChangeSequencersResponse) 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: MsgChangeSequencersResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgChangeSequencersResponse: 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") -) diff --git a/modules/sequencer/types/types.pb.go b/modules/sequencer/types/types.pb.go deleted file mode 100644 index 8ec5caf..0000000 --- a/modules/sequencer/types/types.pb.go +++ /dev/null @@ -1,617 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: rollkitsdk/sequencer/v1/types.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - types "github.com/cosmos/cosmos-sdk/codec/types" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/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 - -// Sequencer defines a sequence of instructions to be executed. -type Sequencer struct { - // name is the human-readable name of the sequence. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // consensus_pubkey is the consensus public key of the sequencer, as a - // Protobuf Any. - ConsensusPubkey *types.Any `protobuf:"bytes,2,opt,name=consensus_pubkey,json=consensusPubkey,proto3" json:"consensus_pubkey,omitempty"` -} - -func (m *Sequencer) Reset() { *m = Sequencer{} } -func (m *Sequencer) String() string { return proto.CompactTextString(m) } -func (*Sequencer) ProtoMessage() {} -func (*Sequencer) Descriptor() ([]byte, []int) { - return fileDescriptor_40268d963f9caa84, []int{0} -} -func (m *Sequencer) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Sequencer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Sequencer.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 *Sequencer) XXX_Merge(src proto.Message) { - xxx_messageInfo_Sequencer.Merge(m, src) -} -func (m *Sequencer) XXX_Size() int { - return m.Size() -} -func (m *Sequencer) XXX_DiscardUnknown() { - xxx_messageInfo_Sequencer.DiscardUnknown(m) -} - -var xxx_messageInfo_Sequencer proto.InternalMessageInfo - -func (m *Sequencer) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Sequencer) GetConsensusPubkey() *types.Any { - if m != nil { - return m.ConsensusPubkey - } - return nil -} - -// SequencerChanges defines a sequence of instructions to be executed. -type SequencerChanges struct { - // block height that trigger the change sequencer - BlockHeight uint64 `protobuf:"varint,1,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` - // sequencers is the list pubkey that will become new sequencers. - Sequencers []Sequencer `protobuf:"bytes,2,rep,name=sequencers,proto3" json:"sequencers"` -} - -func (m *SequencerChanges) Reset() { *m = SequencerChanges{} } -func (m *SequencerChanges) String() string { return proto.CompactTextString(m) } -func (*SequencerChanges) ProtoMessage() {} -func (*SequencerChanges) Descriptor() ([]byte, []int) { - return fileDescriptor_40268d963f9caa84, []int{1} -} -func (m *SequencerChanges) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SequencerChanges) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SequencerChanges.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 *SequencerChanges) XXX_Merge(src proto.Message) { - xxx_messageInfo_SequencerChanges.Merge(m, src) -} -func (m *SequencerChanges) XXX_Size() int { - return m.Size() -} -func (m *SequencerChanges) XXX_DiscardUnknown() { - xxx_messageInfo_SequencerChanges.DiscardUnknown(m) -} - -var xxx_messageInfo_SequencerChanges proto.InternalMessageInfo - -func (m *SequencerChanges) GetBlockHeight() uint64 { - if m != nil { - return m.BlockHeight - } - return 0 -} - -func (m *SequencerChanges) GetSequencers() []Sequencer { - if m != nil { - return m.Sequencers - } - return nil -} - -func init() { - proto.RegisterType((*Sequencer)(nil), "rollkitsdk.sequencer.v1.Sequencer") - proto.RegisterType((*SequencerChanges)(nil), "rollkitsdk.sequencer.v1.SequencerChanges") -} - -func init() { - proto.RegisterFile("rollkitsdk/sequencer/v1/types.proto", fileDescriptor_40268d963f9caa84) -} - -var fileDescriptor_40268d963f9caa84 = []byte{ - // 371 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x3f, 0x6b, 0xdb, 0x40, - 0x18, 0xc6, 0x75, 0xae, 0x29, 0xf8, 0x5c, 0xa8, 0x2b, 0x0c, 0x55, 0x3d, 0xa8, 0xae, 0xbb, 0x98, - 0x82, 0xef, 0xb0, 0xbb, 0x76, 0xa9, 0xbb, 0x14, 0x4a, 0xc1, 0xa8, 0x50, 0x48, 0x16, 0x23, 0x9d, - 0x2f, 0x27, 0x21, 0xe9, 0x5e, 0x45, 0xa7, 0x33, 0x51, 0xe6, 0x7c, 0x80, 0x7c, 0x8c, 0x8c, 0x19, - 0xf2, 0x21, 0x4c, 0x26, 0x8f, 0x99, 0x42, 0xb0, 0x87, 0x7c, 0x8d, 0x90, 0x93, 0xad, 0x78, 0xc9, - 0x72, 0xbc, 0xff, 0xee, 0xf7, 0xbc, 0x3c, 0x2f, 0xfe, 0x9a, 0x43, 0x92, 0xc4, 0x51, 0xa1, 0x16, - 0x31, 0x55, 0xfc, 0x54, 0x73, 0xc9, 0x78, 0x4e, 0x97, 0x63, 0x5a, 0x94, 0x19, 0x57, 0x24, 0xcb, - 0xa1, 0x00, 0xfb, 0xe3, 0xcb, 0x10, 0xa9, 0x87, 0xc8, 0x72, 0xdc, 0xfb, 0xe0, 0xa7, 0x91, 0x04, - 0x6a, 0xde, 0x6a, 0xb6, 0xf7, 0x89, 0x81, 0x4a, 0x41, 0xcd, 0x4d, 0x46, 0xab, 0x64, 0xd7, 0xea, - 0x0a, 0x10, 0x50, 0xd5, 0x9f, 0xa3, 0xfd, 0x07, 0x01, 0x20, 0x12, 0x4e, 0x4d, 0x16, 0xe8, 0x13, - 0xea, 0xcb, 0xb2, 0x6a, 0x0d, 0xce, 0x71, 0xeb, 0xdf, 0x5e, 0xce, 0xb6, 0x71, 0x53, 0xfa, 0x29, - 0x77, 0x50, 0x1f, 0x0d, 0x5b, 0x9e, 0x89, 0xed, 0x23, 0xdc, 0x61, 0x20, 0x15, 0x97, 0x4a, 0xab, - 0x79, 0xa6, 0x83, 0x98, 0x97, 0x4e, 0xa3, 0x8f, 0x86, 0xed, 0x49, 0x97, 0x54, 0x58, 0xb2, 0xc7, - 0x92, 0x9f, 0xb2, 0x9c, 0x3a, 0xb7, 0x37, 0xa3, 0xee, 0x6e, 0x27, 0x96, 0x97, 0x59, 0x01, 0x64, - 0xa6, 0x83, 0x3f, 0xbc, 0xf4, 0xde, 0xd7, 0x9c, 0x99, 0xc1, 0x0c, 0x2e, 0x10, 0xee, 0xd4, 0xe2, - 0xbf, 0x42, 0x5f, 0x0a, 0xae, 0xec, 0x2f, 0xf8, 0x5d, 0x90, 0x00, 0x8b, 0xe7, 0x21, 0x8f, 0x44, - 0x58, 0x98, 0x5d, 0x9a, 0x5e, 0xdb, 0xd4, 0x7e, 0x9b, 0x92, 0xfd, 0x17, 0xe3, 0xda, 0x22, 0xe5, - 0x34, 0xfa, 0x6f, 0x86, 0xed, 0xc9, 0x80, 0xbc, 0x62, 0x20, 0xa9, 0x15, 0xa6, 0xad, 0xd5, 0xfd, - 0x67, 0xeb, 0xea, 0xf1, 0xfa, 0x1b, 0xf2, 0x0e, 0x00, 0xd3, 0xff, 0xab, 0x8d, 0x8b, 0xd6, 0x1b, - 0x17, 0x3d, 0x6c, 0x5c, 0x74, 0xb9, 0x75, 0xad, 0xf5, 0xd6, 0xb5, 0xee, 0xb6, 0xae, 0x75, 0xfc, - 0x43, 0x44, 0x45, 0xa8, 0x03, 0xc2, 0x20, 0xa5, 0x3b, 0x3c, 0x15, 0x30, 0xe2, 0x67, 0x9c, 0xe9, - 0x22, 0x02, 0x39, 0xf2, 0x03, 0x16, 0xd1, 0x14, 0x16, 0x3a, 0xe1, 0xea, 0xe0, 0xb6, 0xe6, 0xb0, - 0xc1, 0x5b, 0xe3, 0xcb, 0xf7, 0xa7, 0x00, 0x00, 0x00, 0xff, 0xff, 0x39, 0x4e, 0x4d, 0x89, 0x00, - 0x02, 0x00, 0x00, -} - -func (m *Sequencer) 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 *Sequencer) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Sequencer) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ConsensusPubkey != nil { - { - size, err := m.ConsensusPubkey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SequencerChanges) 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 *SequencerChanges) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SequencerChanges) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Sequencers) > 0 { - for iNdEx := len(m.Sequencers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Sequencers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.BlockHeight != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.BlockHeight)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Sequencer) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.ConsensusPubkey != nil { - l = m.ConsensusPubkey.Size() - n += 1 + l + sovTypes(uint64(l)) - } - return n -} - -func (m *SequencerChanges) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BlockHeight != 0 { - n += 1 + sovTypes(uint64(m.BlockHeight)) - } - if len(m.Sequencers) > 0 { - for _, e := range m.Sequencers { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Sequencer) 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 ErrIntOverflowTypes - } - 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: Sequencer: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Sequencer: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - 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 ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsensusPubkey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ConsensusPubkey == nil { - m.ConsensusPubkey = &types.Any{} - } - if err := m.ConsensusPubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SequencerChanges) 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 ErrIntOverflowTypes - } - 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: SequencerChanges: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SequencerChanges: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHeight", wireType) - } - m.BlockHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlockHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sequencers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sequencers = append(m.Sequencers, Sequencer{}) - if err := m.Sequencers[len(m.Sequencers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTypes(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, ErrIntOverflowTypes - } - 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, ErrIntOverflowTypes - } - 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, ErrIntOverflowTypes - } - 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, ErrInvalidLengthTypes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTypes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") -)