diff --git a/app/app.go b/app/app.go index 8347f9fc..dc6d03c6 100644 --- a/app/app.go +++ b/app/app.go @@ -38,15 +38,12 @@ import ( ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ibc "github.com/cosmos/ibc-go/v8/modules/core" - ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" - feeabsmodule "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs" - feeabskeeper "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs/keeper" - feeabstypes "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs/types" "github.com/osmosis-labs/tokenfactory" "github.com/osmosis-labs/tokenfactory/bindings" tokenfactorykeeper "github.com/osmosis-labs/tokenfactory/keeper" @@ -151,6 +148,13 @@ import ( "github.com/CosmWasm/wasmd/x/wasm" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + + "github.com/eve-network/eve/x/rollapp" + rollappkeeper "github.com/eve-network/eve/x/rollapp/keeper" + rollapptypes "github.com/eve-network/eve/x/rollapp/types" + + denommetadatakeeper "github.com/eve-network/eve/x/denommetadata/keeper" + denommetadatatypes "github.com/eve-network/eve/x/denommetadata/types" ) const appName = "EveApp" @@ -205,7 +209,6 @@ var maccPerms = map[string][]string{ tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner}, alliancemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner}, alliancemoduletypes.RewardsPoolName: nil, - feeabstypes.ModuleName: nil, } var ( @@ -245,7 +248,6 @@ type EveApp struct { NFTKeeper nftkeeper.Keeper ConsensusParamsKeeper consensusparamkeeper.Keeper CircuitKeeper circuitkeeper.Keeper - FeeabsKeeper feeabskeeper.Keeper IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly IBCFeeKeeper ibcfeekeeper.Keeper @@ -264,10 +266,13 @@ type EveApp struct { ScopedTransferKeeper capabilitykeeper.ScopedKeeper ScopedIBCFeeKeeper capabilitykeeper.ScopedKeeper ScopedWasmKeeper capabilitykeeper.ScopedKeeper - ScopedFeeabsKeeper capabilitykeeper.ScopedKeeper TokenFactoryKeeper tokenfactorykeeper.Keeper + RollappKeeper rollappkeeper.Keeper + + DenomMetadataKeeper *denommetadatakeeper.Keeper + // the module manager ModuleManager *module.Manager BasicModuleManager module.BasicManager @@ -332,7 +337,8 @@ func NewEveApp( icacontrollertypes.StoreKey, tokenfactorytypes.StoreKey, ibchookstypes.StoreKey, alliancemoduletypes.StoreKey, - feeabstypes.StoreKey, + denommetadatatypes.ModuleName, + rollapptypes.StoreKey, ) tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) @@ -384,7 +390,7 @@ func NewEveApp( scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) scopedWasmKeeper := app.CapabilityKeeper.ScopeToModule(wasmtypes.ModuleName) - scopedFeeabsKeeper := app.CapabilityKeeper.ScopeToModule(feeabstypes.ModuleName) + // add keepers app.AccountKeeper = authkeeper.NewAccountKeeper( @@ -565,8 +571,7 @@ func NewEveApp( // See: https://docs.cosmos.network/main/modules/gov#proposal-messages govRouter := govv1beta1.NewRouter() govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).AddRoute(alliancemoduletypes.RouterKey, alliancemodule.NewAllianceProposalHandler(app.AllianceKeeper)). - AddRoute(feeabstypes.RouterKey, feeabsmodule.NewHostZoneProposal(app.FeeabsKeeper)) + AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).AddRoute(alliancemoduletypes.RouterKey, alliancemodule.NewAllianceProposalHandler(app.AllianceKeeper)) govConfig := govtypes.DefaultConfig() /* @@ -613,20 +618,6 @@ func NewEveApp( // If evidence needs to be handled for the app, set routes in router here and seal app.EvidenceKeeper = *evidenceKeeper - app.FeeabsKeeper = feeabskeeper.NewKeeper( - appCodec, - app.keys[feeabstypes.StoreKey], - app.GetSubspace(feeabstypes.ModuleName), - &app.StakingKeeper, - app.AccountKeeper, - app.BankKeeper.BaseKeeper, - app.TransferKeeper, - app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, - scopedFeeabsKeeper, - ) - - feeabsIBCModule := feeabsmodule.NewIBCModule(appCodec, app.FeeabsKeeper) // Create Interchain Accounts Stack // SendPacket, since it is originating from the application to core IBC: // icaAuthModuleKeeper.SendTx -> icaController.SendPacket -> fee.SendPacket -> channel.SendPacket @@ -658,8 +649,7 @@ func NewEveApp( AddRoute(ibctransfertypes.ModuleName, transferStack). AddRoute(wasmtypes.ModuleName, wasmStack). AddRoute(icacontrollertypes.SubModuleName, icaControllerStack). - AddRoute(icahosttypes.SubModuleName, icaHostStack). - AddRoute(feeabstypes.ModuleName, feeabsIBCModule) + AddRoute(icahosttypes.SubModuleName, icaHostStack) app.IBCKeeper.SetRouter(ibcRouter) app.IBCHooksKeeper = ibchookskeeper.NewKeeper( @@ -716,6 +706,21 @@ func NewEveApp( authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + app.DenomMetadataKeeper = denommetadatakeeper.NewKeeper(app.BankKeeper) + + app.RollappKeeper = *rollappkeeper.NewKeeper( + appCodec, + keys[rollapptypes.StoreKey], + keys[rollapptypes.MemStoreKey], + app.GetSubspace(rollapptypes.ModuleName), + app.IBCKeeper.ClientKeeper, + app.TransferKeeper, + app.IBCKeeper.ChannelKeeper, + app.BankKeeper, + app.DenomMetadataKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + wasmConfig, err := wasm.ReadWasmConfig(appOpts) if err != nil { panic(fmt.Sprintf("error while reading wasm config: %s", err)) @@ -788,7 +793,9 @@ func NewEveApp( // sdk crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them, tokenfactory.NewAppModule(app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(tokenfactorytypes.ModuleName)), - feeabsmodule.NewAppModule(appCodec, app.FeeabsKeeper), + + // nucleic module + rollapp.NewAppModule(appCodec, app.RollappKeeper), ) // BasicModuleManager defines the module BasicManager is in charge of setting up basic, @@ -802,9 +809,6 @@ func NewEveApp( govtypes.ModuleName: gov.NewAppModuleBasic( []govclient.ProposalHandler{ paramsclient.ProposalHandler, - feeabsmodule.UpdateAddHostZoneClientProposalHandler, - feeabsmodule.UpdateDeleteHostZoneClientProposalHandler, - feeabsmodule.UpdateSetHostZoneClientProposalHandler, }, ), alliancemoduletypes.ModuleName: alliancemodule.AppModuleBasic{}, @@ -844,7 +848,7 @@ func NewEveApp( wasmtypes.ModuleName, tokenfactorytypes.ModuleName, alliancemoduletypes.ModuleName, - feeabstypes.ModuleName, + rollapptypes.ModuleName, ) app.ModuleManager.SetOrderEndBlockers( @@ -865,7 +869,7 @@ func NewEveApp( wasmtypes.ModuleName, tokenfactorytypes.ModuleName, alliancemoduletypes.ModuleName, - feeabstypes.ModuleName, + rollapptypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -912,7 +916,8 @@ func NewEveApp( tokenfactorytypes.ModuleName, alliancemoduletypes.ModuleName, - feeabstypes.ModuleName, + denommetadatatypes.ModuleName, + rollapptypes.ModuleName, } app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...) app.ModuleManager.SetOrderExportGenesis(genesisModuleOrder...) @@ -983,7 +988,6 @@ func NewEveApp( app.ScopedWasmKeeper = scopedWasmKeeper app.ScopedICAHostKeeper = scopedICAHostKeeper app.ScopedICAControllerKeeper = scopedICAControllerKeeper - app.ScopedFeeabsKeeper = scopedFeeabsKeeper app.setPostHandler() @@ -1050,7 +1054,6 @@ func (app *EveApp) setAnteHandler(txConfig client.TxConfig, wasmConfig wasmtypes FeegrantKeeper: app.FeeGrantKeeper, SigGasConsumer: ante.DefaultSigVerificationGasConsumer, }, - FeeAbskeeper: app.FeeabsKeeper, IBCKeeper: app.IBCKeeper, WasmConfig: &wasmConfig, WasmKeeper: &app.WasmKeeper, @@ -1307,7 +1310,10 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(tokenfactorytypes.ModuleName).WithKeyTable(tokenfactorytypes.ParamKeyTable()) paramsKeeper.Subspace(wasmtypes.ModuleName) paramsKeeper.Subspace(alliancemoduletypes.ModuleName) - paramsKeeper.Subspace(feeabstypes.ModuleName) + + // register nucleic module key tables + paramsKeeper.Subspace(denommetadatatypes.ModuleName) + paramsKeeper.Subspace(rollapptypes.ModuleName) return paramsKeeper } diff --git a/app/upgrades.go b/app/upgrades.go index a932695b..4021d1ac 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -65,7 +65,7 @@ func (app *EveApp) RegisterUpgradeHandlers() { // register store loader for current upgrade for _, upgrade := range Upgrades { if upgradeInfo.Name == upgrade.UpgradeName { - app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &upgrade.StoreUpgrades)) // nolint:gosec + app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &upgrade.StoreUpgrades)) break } } diff --git a/go.mod b/go.mod index 808d0891..7e2a6119 100644 --- a/go.mod +++ b/go.mod @@ -12,11 +12,10 @@ require ( github.com/cosmos/iavl v1.1.2 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect - github.com/golang/protobuf v1.5.4 // indirect + github.com/golang/protobuf v1.5.4 github.com/google/gofuzz v1.2.0 // indirect github.com/gorilla/mux v1.8.1 // indirect - github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect - github.com/osmosis-labs/fee-abstraction/v8 v8.0.0 + github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.19.0 github.com/spf13/cast v1.6.0 @@ -26,14 +25,15 @@ require ( github.com/stretchr/testify v1.9.0 github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/grpc v1.63.2 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect + google.golang.org/grpc v1.63.2 + gopkg.in/yaml.v2 v2.4.0 ) require ( cosmossdk.io/api v0.7.5 cosmossdk.io/client/v2 v2.0.0-beta.1 - cosmossdk.io/core v0.11.0 + cosmossdk.io/core v0.12.0 + cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.3.1 cosmossdk.io/math v1.3.0 cosmossdk.io/store v1.1.0 @@ -50,8 +50,10 @@ require ( github.com/cosmos/ibc-go/modules/capability v1.0.0 github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.0.0-20240422180908-6ceba47cfa6e github.com/cosmos/ibc-go/v8 v8.2.0 + github.com/osmosis-labs/fee-abstraction/v8 v8.0.0 github.com/osmosis-labs/tokenfactory v0.0.0-20240310155926-981fbeb0fe42 github.com/terra-money/alliance v0.4.3 + google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de ) require ( @@ -62,7 +64,6 @@ require ( cloud.google.com/go/storage v1.36.0 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/depinject v1.0.0-alpha.4 // indirect - cosmossdk.io/errors v1.0.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -204,7 +205,6 @@ require ( golang.org/x/time v0.5.0 // indirect google.golang.org/api v0.162.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/proto/buf.gen.gogo.yml b/proto/buf.gen.gogo.yml new file mode 100644 index 00000000..855ea251 --- /dev/null +++ b/proto/buf.gen.gogo.yml @@ -0,0 +1,8 @@ +version: v1 +plugins: + - name: gocosmos + out: .. + opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types + - name: grpc-gateway + out: .. + opt: logtostderr=true,allow_colon_final_segments=true \ No newline at end of file diff --git a/proto/buf.lock b/proto/buf.lock new file mode 100644 index 00000000..a4e9f3a6 --- /dev/null +++ b/proto/buf.lock @@ -0,0 +1,28 @@ +# Generated by buf. DO NOT EDIT. +version: v1 +deps: + - remote: buf.build + owner: cosmos + repository: cosmos-proto + commit: 1935555c206d4afb9e94615dfd0fad31 + digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377 + - remote: buf.build + owner: cosmos + repository: cosmos-sdk + commit: 5a6ab7bc14314acaa912d5e53aef1c2f + digest: shake256:02c00c73493720055f9b57553a35b5550023a3c1914123b247956288a78fb913aff70e66552777ae14d759467e119079d484af081264a5dd607a94d9fbc8116b + - remote: buf.build + owner: cosmos + repository: gogo-proto + commit: 34d970b699f84aa382f3c29773a60836 + digest: shake256:3d3bee5229ba579e7d19ffe6e140986a228b48a8c7fe74348f308537ab95e9135210e81812489d42cd8941d33ff71f11583174ccc5972e86e6112924b6ce9f04 + - remote: buf.build + owner: cosmos + repository: ics23 + commit: 55085f7c710a45f58fa09947208eb70b + digest: shake256:9bf0bc495b5a11c88d163d39ef521bc4b00bc1374a05758c91d82821bdc61f09e8c2c51dda8452529bf80137f34d852561eacbe9550a59015d51cecb0dacb628 + - remote: buf.build + owner: googleapis + repository: googleapis + commit: 8d7204855ec14631a499bd7393ce1970 + digest: shake256:40bf4112960cad01281930beed85829910768e32e80e986791596853eccd42c0cbd9d96690b918f658020d2d427e16f8b6514e2ac7f4a10306fd32e77be44329 diff --git a/proto/buf.yaml b/proto/buf.yaml new file mode 100644 index 00000000..69de69e3 --- /dev/null +++ b/proto/buf.yaml @@ -0,0 +1,23 @@ +version: v1 +name: buf.build/nucleic-network/nucleic +deps: + - buf.build/cosmos/cosmos-sdk:v0.50.0 + - buf.build/cosmos/cosmos-proto:1935555c206d4afb9e94615dfd0fad31 + - buf.build/cosmos/gogo-proto:a14993478f40695898ed8a86931094b6656e8a5d + - buf.build/googleapis/googleapis:8d7204855ec14631a499bd7393ce1970 + - buf.build/cosmos/ics23:b1abd8678aab07165efd453c96796a179eb3131f +breaking: + use: + - FILE +lint: + use: + - DEFAULT + - COMMENTS + - FILE_LOWER_SNAKE_CASE + except: + - UNARY_RPC + - COMMENT_FIELD + - SERVICE_SUFFIX + - PACKAGE_VERSION_SUFFIX + - RPC_REQUEST_STANDARD_NAME + - PACKAGE_DIRECTORY_MATCH \ No newline at end of file diff --git a/proto/nucleic/denommetadata/genesis.proto b/proto/nucleic/denommetadata/genesis.proto new file mode 100644 index 00000000..f3c58e36 --- /dev/null +++ b/proto/nucleic/denommetadata/genesis.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; +package nucleic.denommetadata; + +option go_package = "github.com/nucleic-network/nucleic/x/denommetadata/types"; + +// GenesisState defines the denommetadata module's various parameters when first +// initialized +message GenesisState {} \ No newline at end of file diff --git a/proto/nucleic/denommetadata/gov.proto b/proto/nucleic/denommetadata/gov.proto new file mode 100644 index 00000000..c00d52d0 --- /dev/null +++ b/proto/nucleic/denommetadata/gov.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; +package nucleic.denommetadata; + +option go_package = "github.com/nucleic-network/nucleic/x/denommetadata/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/bank/v1beta1/bank.proto"; + +message CreateDenomMetadataProposal { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + string title = 1; + string description = 2; + repeated cosmos.bank.v1beta1.Metadata token_metadata = 3[ (gogoproto.nullable) = false ]; +} + +message UpdateDenomMetadataProposal { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + string title = 1; + string description = 2; + repeated cosmos.bank.v1beta1.Metadata token_metadata = 3[ (gogoproto.nullable) = false ]; +} \ No newline at end of file diff --git a/proto/nucleic/rollapp/bank.proto b/proto/nucleic/rollapp/bank.proto new file mode 100644 index 00000000..25cc741b --- /dev/null +++ b/proto/nucleic/rollapp/bank.proto @@ -0,0 +1,53 @@ +syntax = "proto3"; +package nucleic.rollapp; + +option go_package = "github.com/nucleic-network/nucleic/x/rollapp/types"; + +import "gogoproto/gogo.proto"; + +// DenomUnit represents a struct that describes a given +// denomination unit of the basic token. +message DenomUnit { + // denom represents the string name of the given denom unit (e.g uatom). + string denom = 1; + // exponent represents power of 10 exponent that one must + // raise the base_denom to in order to equal the given DenomUnit's denom + // 1 denom = 10^exponent base_denom + // (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with + // exponent = 6, thus: 1 atom = 10^6 uatom). + uint32 exponent = 2; + // aliases is a list of string aliases for the given denom + repeated string aliases = 3; +} + +// Metadata represents a struct that describes +// a basic token. +message TokenMetadata { + string description = 1; + // denom_units represents the list of DenomUnit's for a given coin + repeated DenomUnit denom_units = 2; + // base represents the base denom (should be the DenomUnit with exponent = 0). + string base = 3; + // display indicates the suggested denom that should be + // displayed in clients. + string display = 4; + // name defines the name of the token (eg: Cosmos Atom) + // + // Since: cosmos-sdk 0.43 + string name = 5; + // symbol is the token symbol usually shown on exchanges (eg: ATOM). This can + // be the same as the display. + // + // Since: cosmos-sdk 0.43 + string symbol = 6; + // URI to a document (on or off-chain) that contains additional information. + // Optional. + // + // Since: cosmos-sdk 0.46 + string uri = 7 [ (gogoproto.customname) = "URI" ]; + // URIHash is a sha256 hash of a document pointed by URI. It's used to verify + // that the document didn't change. Optional. + // + // Since: cosmos-sdk 0.46 + string uri_hash = 8 [ (gogoproto.customname) = "URIHash" ]; +} diff --git a/proto/nucleic/rollapp/block_descriptor.proto b/proto/nucleic/rollapp/block_descriptor.proto new file mode 100644 index 00000000..756186ee --- /dev/null +++ b/proto/nucleic/rollapp/block_descriptor.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; +package nucleic.rollapp; + +option go_package = "github.com/nucleic-network/nucleic/x/rollapp/types"; + +import "gogoproto/gogo.proto"; + +// BlockDescriptor defines a single rollapp chain block description. +message BlockDescriptor { + // height is the height of the block + uint64 height = 1; + // state_root is a 32 byte array of the hash of the block (state root of the + // block) + bytes state_root = 2; +} + +// BlockDescriptors defines list of BlockDescriptor. +message BlockDescriptors { + repeated BlockDescriptor block_descs = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/nucleic/rollapp/genesis.proto b/proto/nucleic/rollapp/genesis.proto new file mode 100644 index 00000000..d356f087 --- /dev/null +++ b/proto/nucleic/rollapp/genesis.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; +package nucleic.rollapp; + +option go_package = "github.com/nucleic-network/nucleic/x/rollapp/types"; + +import "gogoproto/gogo.proto"; +import "nucleic/rollapp/params.proto"; +import "nucleic/rollapp/rollapp.proto"; +import "nucleic/rollapp/state_info.proto"; + +// GenesisState defines the rollapp module's genesis state. +message GenesisState { + Params params = 1 [ (gogoproto.nullable) = false ]; + repeated Rollapp rollapp_list = 2 [ (gogoproto.nullable) = false ]; + repeated StateInfo state_info_list = 3 [ (gogoproto.nullable) = false ]; + repeated StateInfoIndex latest_state_info_index_list = 4 + [ (gogoproto.nullable) = false ]; + repeated StateInfoIndex latest_finalized_state_index_list = 5 + [ (gogoproto.nullable) = false ]; + repeated BlockHeightToFinalizationQueue + block_height_to_finalization_queue_list = 6 + [ (gogoproto.nullable) = false ]; +} diff --git a/proto/nucleic/rollapp/params.proto b/proto/nucleic/rollapp/params.proto new file mode 100644 index 00000000..ec9ecd70 --- /dev/null +++ b/proto/nucleic/rollapp/params.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; +package nucleic.rollapp; + +option go_package = "github.com/nucleic-network/nucleic/x/rollapp/types"; + +import "gogoproto/gogo.proto"; + +message DeployerParams { + // address is a bech32-encoded address of the + // accounts that are allowed to create a rollapp. + string address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; +} + +// Params defines the parameters for the module. +message Params { + option (gogoproto.goproto_stringer) = false; + + // dispute_period_in_blocks the number of blocks it takes + // to change a status of a state from received to finalized. + // during that period, any user could submit fraud proof + uint64 dispute_period_in_blocks = 1 + [ (gogoproto.moretags) = "yaml:\"dispute_period_in_blocks\"" ]; + + // deployer_whitelist is a list of the + // accounts that are allowed to create a rollapp and maximum number of + // rollapps. In the case of an empty list, there are no restrictions + repeated DeployerParams deployer_whitelist = 2 [ + (gogoproto.moretags) = "yaml:\"deployer_whitelist\"", + (gogoproto.nullable) = false + ]; + + bool rollapps_enabled = 3 + [ (gogoproto.moretags) = "yaml:\"rollapps_enabled\"" ]; +} diff --git a/proto/nucleic/rollapp/query.proto b/proto/nucleic/rollapp/query.proto new file mode 100644 index 00000000..5c2d9a20 --- /dev/null +++ b/proto/nucleic/rollapp/query.proto @@ -0,0 +1,114 @@ +syntax = "proto3"; +package nucleic.rollapp; + +option go_package = "github.com/nucleic-network/nucleic/x/rollapp/types"; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "nucleic/rollapp/params.proto"; +import "nucleic/rollapp/rollapp.proto"; +import "nucleic/rollapp/state_info.proto"; + +// Query defines the gRPC querier service. +service Query { + // Parameters queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/nucleic/rollapp/params"; + } + // Queries a Rollapp by index. + rpc Rollapp(QueryGetRollappRequest) returns (QueryGetRollappResponse) { + option (google.api.http).get = "/nucleic/rollapp/rollapp/{rollapp_id}"; + } + + // Queries a Rollapp by index. + rpc RollappByEIP155(QueryGetRollappByEIP155Request) + returns (QueryGetRollappResponse) { + option (google.api.http).get = "/nucleic/rollapp/eip155/{eip155}"; + } + + // Queries a list of Rollapp items. + rpc RollappAll(QueryAllRollappRequest) returns (QueryAllRollappResponse) { + option (google.api.http).get = "/nucleic/rollapp/rollapp"; + } + + // Queries a LatestHeight by rollapp-id. + rpc LatestHeight(QueryGetLatestHeightRequest) + returns (QueryGetLatestHeightResponse) { + option (google.api.http).get = + "/nucleic/rollapp/latest_height/{rollapp_id}"; + } + + // Queries a LatestStateIndex by rollapp-id. + rpc LatestStateIndex(QueryGetLatestStateIndexRequest) + returns (QueryGetLatestStateIndexResponse) { + option (google.api.http).get = + "/nucleic/rollapp/latest_state_index/{rollapp_id}"; + } + + // Queries a StateInfo by index. + rpc StateInfo(QueryGetStateInfoRequest) returns (QueryGetStateInfoResponse) { + option (google.api.http).get = + "/nucleic/rollapp/state_info/{rollapp_id}/{index}"; + } +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 [ (gogoproto.nullable) = false ]; +} + +message QueryGetRollappRequest { string rollapp_id = 1; } + +message QueryGetRollappByEIP155Request { uint64 eip155 = 1; } + +message QueryGetLatestHeightRequest { + string rollapp_id = 1; + bool finalized = 2; +} + +message QueryGetLatestHeightResponse { uint64 height = 1; } + +message QueryGetLatestStateIndexRequest { + string rollapp_id = 1; + bool finalized = 2; +} + +message QueryGetLatestStateIndexResponse { + StateInfoIndex state_index = 1 [ (gogoproto.nullable) = false ]; +} + +message QueryGetRollappResponse { + Rollapp rollapp = 1 [ (gogoproto.nullable) = false ]; + // Defines the index of the last rollapp UpdateState. + StateInfoIndex latest_state_index = 2; + // Defines the index of the last rollapp UpdateState that was finalized. + StateInfoIndex latest_finalized_state_index = 3; + + uint64 latest_height = 4; + uint64 latest_finalized_height = 5; +} + +message QueryAllRollappRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllRollappResponse { + repeated RollappSummary rollapp = 1 [ (gogoproto.nullable) = false ]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +message QueryGetStateInfoRequest { + string rollapp_id = 1; + uint64 index = 2; + uint64 height = 3; + bool finalized = 4; +} + +message QueryGetStateInfoResponse { + StateInfo state_info = 1 [ (gogoproto.nullable) = false ]; +} diff --git a/proto/nucleic/rollapp/rollapp.proto b/proto/nucleic/rollapp/rollapp.proto new file mode 100644 index 00000000..c52249ba --- /dev/null +++ b/proto/nucleic/rollapp/rollapp.proto @@ -0,0 +1,68 @@ +syntax = "proto3"; +package nucleic.rollapp; + +option go_package = "github.com/nucleic-network/nucleic/x/rollapp/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "nucleic/rollapp/state_info.proto"; +import "nucleic/rollapp/bank.proto"; + +// GenesisAccount is a struct for the genesis account for the rollapp +message GenesisAccount { + // amount of coins to be sent to the genesis address + cosmos.base.v1beta1.Coin amount = 1 [ (gogoproto.nullable) = false ]; + // address is a bech-32 address of the genesis account + string address = 2; +} + +// RollappGenesisState is a partial repr of the state the hub can expect the +// rollapp to be in upon genesis +message RollappGenesisState { + // genesis_accounts is a list of token allocations + repeated GenesisAccount genesis_accounts = 1; + // is_genesis_event is a boolean that indicates if the genesis event has + // occured + bool is_genesis_event = 2; +} + +// Rollapp defines a rollapp object. First the RollApp is created and then +// sequencers can be created and attached. The RollApp is identified by +// rollapp_id +message Rollapp { + // The unique identifier of the rollapp chain. + // The rollapp_id follows the same standard as cosmos chain_id. + string rollapp_id = 1; + // creator is the bech32-encoded address of the rollapp creator. + string creator = 2; + // version is the software and configuration version. + // starts from 1 and increases by one on every MsgUpdateState + uint64 version = 3; + // max_sequencers is the maximum number of sequencers. + uint64 max_sequencers = 4; + // permissioned_addresses is a bech32-encoded address list of the sequencers + // that are allowed to serve this rollapp_id. In the case of an empty list, + // the rollapp is considered permissionless. + repeated string permissioned_addresses = 5; + // token_metadata is a list of TokenMetadata that are registered on this + // rollapp + repeated TokenMetadata token_metadata = 6; + // genesis_state is a partial repr of the state the hub can expect the rollapp + // to be in upon genesis + RollappGenesisState genesis_state = 7 [ (gogoproto.nullable) = false ]; + // channel_id will be set to the canonical IBC channel of the rollapp. + string channel_id = 8; + // frozen is a boolean that indicates if the rollapp is frozen. + bool frozen = 9; +} + +// Rollapp summary is a compact representation of Rollapp +message RollappSummary { + // The unique identifier of the rollapp chain. + // The rollapp_id follows the same standard as cosmos chain_id. + string rollapp_id = 1; + // Defines the index of the last rollapp UpdateState. + StateInfoIndex latest_state_index = 2; + // Defines the index of the last rollapp UpdateState that was finalized. + StateInfoIndex latest_finalized_state_index = 3; +} diff --git a/proto/nucleic/rollapp/state_info.proto b/proto/nucleic/rollapp/state_info.proto new file mode 100644 index 00000000..a903f4c0 --- /dev/null +++ b/proto/nucleic/rollapp/state_info.proto @@ -0,0 +1,79 @@ +syntax = "proto3"; +package nucleic.rollapp; + +option go_package = "github.com/nucleic-network/nucleic/x/rollapp/types"; + +import "gogoproto/gogo.proto"; +import "nucleic/rollapp/block_descriptor.proto"; + +// StateInfoIndex is the data used for indexing and retrieving a StateInfo +// it updated and saved with every UpdateState in StateInfo. +// We use the this structure also for: +// 1. LatestStateInfoIndex which defines the rollapps' current (latest) index of +// the last UpdateState +// 2. LatestFinalizedStateIndex which defines the rollapps' current (latest) +// index of the latest StateInfo that was finalized +message StateInfoIndex { + // rollapp_id is the rollapp that the sequencer belongs to and asking to + // update it used to identify the what rollapp a StateInfo belongs The + // rollapp_id follows the same standard as cosmos chain_id + string rollapp_id = 1; + // index is a sequential increasing number, updating on each + // state update used for indexing to a specific state info, the first index is + // 1 + uint64 index = 2; +} + +// StateInfo defines a rollapps' state. +message StateInfo { + // state_info_index defines what rollapp the state belongs to + // and in which index it can be referenced + StateInfoIndex state_info_index = 1 [ (gogoproto.nullable) = false ]; + // sequencer is the bech32-encoded address of the sequencer sent the update + string sequencer = 2; + // start_height is the block height of the first block in the batch + uint64 start_height = 3; + // num_blocks is the number of blocks included in this batch update + uint64 num_blocks = 4; + // da_path is the description of the location on the DA layer + string da_path = 5; + // version is the version of the rollapp + uint64 version = 6; + // creation_height is the height at which the UpdateState took place + uint64 creation_height = 7; + // status is the status of the state update + Status status = 8; + // bds is a list of block description objects (one per block) + // the list must be ordered by height, starting from start_height to + // start_height+num_blocks-1 + BlockDescriptors block_descs = 9 [ (gogoproto.nullable) = false ]; +} + +// StateInfoSummary is a compact representation of StateInfo +message StateInfoSummary { + // state_info_index defines what rollapp the state belongs to + // and in which index it can be referenced + StateInfoIndex state_info_index = 1 [ (gogoproto.nullable) = false ]; + // status is the status of the state update + Status status = 2; + // creation_height is the height at which the UpdateState took place + uint64 creation_height = 3; +} + +// BlockHeightToFinalizationQueue defines a map from block height to list of +// states to finalized +message BlockHeightToFinalizationQueue { + // creation_height is the block height that the state should be finalized + uint64 creation_height = 1; + // finalization_queue is a list of states that are waiting to be finalized + // when the block height becomes creation_height + repeated StateInfoIndex finalization_queue = 2 + [ (gogoproto.nullable) = false ]; +} + +// Status of state +enum Status { + PENDING = 0; + FINALIZED = 1; + REVERTED = 3; +} diff --git a/proto/nucleic/rollapp/tx.proto b/proto/nucleic/rollapp/tx.proto new file mode 100644 index 00000000..81a31b41 --- /dev/null +++ b/proto/nucleic/rollapp/tx.proto @@ -0,0 +1,76 @@ +syntax = "proto3"; +package nucleic.rollapp; + +option go_package = "github.com/nucleic-network/nucleic/x/rollapp/types"; + +import "gogoproto/gogo.proto"; +import "nucleic/rollapp/block_descriptor.proto"; +import "nucleic/rollapp/bank.proto"; +import "nucleic/rollapp/rollapp.proto"; + +// Msg defines the Msg service. +service Msg { + rpc CreateRollapp(MsgCreateRollapp) returns (MsgCreateRollappResponse); + rpc UpdateState(MsgUpdateState) returns (MsgUpdateStateResponse); + rpc TriggerGenesisEvent(MsgRollappGenesisEvent) + returns (MsgRollappGenesisEventResponse); +} + +// MsgCreateRollapp creates a new rollapp chain on the hub. +message MsgCreateRollapp { + // creator is the bech32-encoded address of the rollapp creator + string creator = 1; + // rollapp_id is the unique identifier of the rollapp chain. + // The rollapp_id follows the same standard as cosmos chain_id + string rollapp_id = 2; // [(gogoproto.customname) = "ChainID"]; + // max_sequencers is the maximum number of sequencers + uint64 max_sequencers = 6; + // permissioned_addresses is a bech32-encoded address list of the + // sequencers that are allowed to serve this rollapp_id. + // In the case of an empty list, the rollapp is considered permissionless + repeated string permissioned_addresses = 7; + // metadata provides the client information for all the registered tokens. + repeated TokenMetadata metadatas = 8 [ (gogoproto.nullable) = false ]; + // genesis_accounts for the rollapp on the hub + repeated GenesisAccount genesis_accounts = 9 [ (gogoproto.nullable) = false ]; +} + +message MsgCreateRollappResponse {} + +// MsgUpdateState updates a rollapp state with a block batch. +// a block batch is a list of ordered blocks (by height) +message MsgUpdateState { + // creator is the bech32-encoded address of the sequencer sending the update + string creator = 1; + // rollapp_id is the rollapp that the sequencer belongs to and asking to update + // The rollapp_id follows the same standard as cosmos chain_id + string rollapp_id = 2; + // start_height is the block height of the first block in the batch + uint64 start_height = 3; + // num_blocks is the number of blocks included in this batch update + uint64 num_blocks = 4; + // da_path is the description of the location on the DA layer + string da_path = 5; + // version is the version of the rollapp + uint64 version = 6; + // block_descs is a list of block description objects (one per block) + // the list must be ordered by height, starting from start_height to + // start_height+num_blocks-1 + BlockDescriptors block_descs = 7 [ (gogoproto.nullable) = false ]; +} + +message MsgUpdateStateResponse {} + +// MsgRollappGenesisEvent is the message type for triggering the genesis event +// of the rollapp +message MsgRollappGenesisEvent { + // address is the bech32-encoded address of the sender + string address = 1; + // channel_id is the rollapp channel id on the hub + string channel_id = 2; + // rollapp_id is the rollapp id we want to mint tokens on the hub. + // Used for validation against channel_id to reduce error surface. + string rollapp_id = 3; +} + +message MsgRollappGenesisEventResponse {} diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh new file mode 100644 index 00000000..6d3b2551 --- /dev/null +++ b/scripts/protocgen.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -eo pipefail + +echo "Generating gogo proto code" +cd proto +proto_dirs=$(find ./nucleic -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq) +for dir in $proto_dirs; do + for file in $(find "${dir}" -maxdepth 1 -name '*.proto'); do + if grep "option go_package" $file &>/dev/null; then + buf generate --template buf.gen.gogo.yml $file + fi + done +done + +cd .. + +# move proto files to the right places +cp -r github.com/nucleic-network/nucleic/* ./ +rm -rf github.com diff --git a/utils/ibc.go b/utils/ibc.go new file mode 100644 index 00000000..5a24b6ce --- /dev/null +++ b/utils/ibc.go @@ -0,0 +1,21 @@ +package utils + +import ( + transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" +) + +const ( + ibcPort = "transfer" +) + +func GetForeignIBCDenom(channelId, denom string) string { + return GetForeignDenomTrace(channelId, denom).IBCDenom() +} + +func GetForeignDenomTrace(channelId, denom string) transfertypes.DenomTrace { + sourcePrefix := transfertypes.GetDenomPrefix(ibcPort, channelId) + // NOTE: sourcePrefix contains the trailing "/" + prefixedDenom := sourcePrefix + denom + // construct the denomination trace from the full raw denomination + return transfertypes.ParseDenomTrace(prefixedDenom) +} diff --git a/utils/json.go b/utils/json.go new file mode 100644 index 00000000..a2812c31 --- /dev/null +++ b/utils/json.go @@ -0,0 +1,22 @@ +package utils + +import ( + "encoding/json" + "os" +) + +// ParseJsonFromFile parses a json file into a slice of type T +func ParseJsonFromFile[T any](path string) ([]T, error) { + var result []T + + contents, err := os.ReadFile(path) + if err != nil { + return nil, err + } + + err = json.Unmarshal(contents, &result) + if err != nil { + return nil, err + } + return result, nil +} diff --git a/x/denommetadata/client/cli/query.go b/x/denommetadata/client/cli/query.go new file mode 100644 index 00000000..7f1e458c --- /dev/null +++ b/x/denommetadata/client/cli/query.go @@ -0,0 +1 @@ +package cli diff --git a/x/denommetadata/client/cli/tx.go b/x/denommetadata/client/cli/tx.go new file mode 100644 index 00000000..7f1e458c --- /dev/null +++ b/x/denommetadata/client/cli/tx.go @@ -0,0 +1 @@ +package cli diff --git a/x/denommetadata/keeper/keeper.go b/x/denommetadata/keeper/keeper.go new file mode 100644 index 00000000..2cd3696f --- /dev/null +++ b/x/denommetadata/keeper/keeper.go @@ -0,0 +1,72 @@ +package keeper + +import ( + "fmt" + + "cosmossdk.io/log" + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/eve-network/eve/x/denommetadata/types" +) + +type Keeper struct { + bankKeeper types.BankKeeper + hooks types.MultiDenomMetadataHooks +} + +// NewKeeper returns a new instance of the denommetadata keeper +func NewKeeper(bankKeeper types.BankKeeper) *Keeper { + return &Keeper{ + bankKeeper: bankKeeper, + hooks: nil, + } +} + +// CreateDenomMetadata creates a new denommetadata +func (k *Keeper) CreateDenomMetadata(ctx sdk.Context, metadata banktypes.Metadata) error { + found := k.bankKeeper.HasDenomMetaData(ctx, metadata.Base) + if found { + return types.ErrDenomAlreadyExists + } + k.bankKeeper.SetDenomMetaData(ctx, metadata) + err := k.hooks.AfterDenomMetadataCreation(ctx, metadata) + if err != nil { + return err + } + return nil +} + +// UpdateDenomMetadata returns the denommetadata of the specified denom +func (k *Keeper) UpdateDenomMetadata(ctx sdk.Context, metadata banktypes.Metadata) error { + found := k.bankKeeper.HasDenomMetaData(ctx, metadata.Base) + if !found { + return types.ErrDenomDoesNotExist + } + k.bankKeeper.SetDenomMetaData(ctx, metadata) + err := k.hooks.AfterDenomMetadataUpdate(ctx, metadata) + if err != nil { + return err + } + return nil +} + +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} + +/* -------------------------------------------------------------------------- */ +/* Hooks */ +/* -------------------------------------------------------------------------- */ + +// SetHooks sets the hooks for the denommetadata keeper +func (k *Keeper) SetHooks(sh types.MultiDenomMetadataHooks) { + if k.hooks != nil { + panic("cannot set rollapp hooks twice") + } + k.hooks = sh +} + +// GetHooks returns the hooks for the denommetadata keeper +func (k *Keeper) GetHooks() types.MultiDenomMetadataHooks { + return k.hooks +} diff --git a/x/denommetadata/module.go b/x/denommetadata/module.go new file mode 100644 index 00000000..de169423 --- /dev/null +++ b/x/denommetadata/module.go @@ -0,0 +1,177 @@ +package denommetadata + +import ( + "context" + "encoding/json" + + "cosmossdk.io/core/appmodule" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/types/simulation" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/eve-network/eve/x/denommetadata/keeper" + "github.com/eve-network/eve/x/denommetadata/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" +) + +var ( + _ module.AppModuleBasic = AppModuleBasic{} + _ module.HasGenesisBasics = AppModuleBasic{} + + _ appmodule.AppModule = AppModule{} + _ module.HasConsensusVersion = AppModule{} + _ module.HasGenesis = AppModule{} + _ module.HasServices = AppModule{} +) + +// AppModuleBasic implements the AppModuleBasic interface that defines the +// independent methods a Cosmos SDK module needs to implement. +type AppModuleBasic struct { +} + +// DefaultGenesis implements module.HasGenesisBasics. +func (a AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis implements module.HasGenesisBasics. +func (a AppModuleBasic) ValidateGenesis(codec.JSONCodec, client.TxEncodingConfig, json.RawMessage) error { + return nil +} + +// Name implements module.AppModuleBasic. +func (a AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterGRPCGatewayRoutes implements module.AppModuleBasic. +func (a AppModuleBasic) RegisterGRPCGatewayRoutes(client.Context, *runtime.ServeMux) { +} + +// RegisterInterfaces implements module.AppModuleBasic. +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// RegisterLegacyAminoCodec implements module.AppModuleBasic. +func (a AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(cdc) +} + +func NewAppModuleBasic() AppModuleBasic { + return AppModuleBasic{} +} + +// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + bankKeeper bankkeeper.Keeper +} + +// RegisterServices implements module.HasServices. +func (a AppModule) RegisterServices(module.Configurator) { +} + +// DefaultGenesis implements module.HasGenesis. +func (a AppModule) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ExportGenesis implements module.HasGenesis. +func (a AppModule) ExportGenesis(sdk.Context, codec.JSONCodec) json.RawMessage { + return nil +} + +// InitGenesis implements module.HasGenesis. +func (a AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) { + a.bankKeeper.IterateAllDenomMetaData(ctx, func(metadata banktypes.Metadata) bool { + // run hooks for each denom metadata, thus `x/denommetadata` genesis init order must be after `x/bank` genesis init + err := a.keeper.GetHooks().AfterDenomMetadataCreation(ctx, metadata) + if err != nil { + panic(err) // error at genesis level should be reported by panic + } + + return false + }) +} + +// ValidateGenesis implements module.HasGenesis. +func (a AppModule) ValidateGenesis(codec.JSONCodec, client.TxEncodingConfig, json.RawMessage) error { + panic("unimplemented") +} + +// ConsensusVersion implements module.HasConsensusVersion. +func (a AppModule) ConsensusVersion() uint64 { + return 1 +} + +// IsAppModule implements appmodule.AppModule. +func (a AppModule) IsAppModule() { +} + +// IsOnePerModuleType implements appmodule.AppModule. +func (a AppModule) IsOnePerModuleType() { + panic("unimplemented") +} + +// EndBlock implements appmodule.HasEndBlocker. +func (a *AppModule) EndBlock(context.Context) error { + panic("unimplemented") +} + +// BeginBlock implements appmodule.HasBeginBlocker. +func (a *AppModule) BeginBlock(context.Context) error { + panic("unimplemented") +} + +// GenerateGenesisState implements module.AppModuleSimulation. +func (a *AppModule) GenerateGenesisState(input *module.SimulationState) { + panic("unimplemented") +} + +// RegisterStoreDecoder implements module.AppModuleSimulation. +func (a *AppModule) RegisterStoreDecoder(simulation.StoreDecoderRegistry) { + panic("unimplemented") +} + +// WeightedOperations implements module.AppModuleSimulation. +func (a *AppModule) WeightedOperations(simState module.SimulationState) []simulation.WeightedOperation { + panic("unimplemented") +} + +// Name implements module.AppModuleBasic. +func (a *AppModule) Name() string { + return types.ModuleName +} + +// RegisterGRPCGatewayRoutes implements module.AppModuleBasic. +func (a *AppModule) RegisterGRPCGatewayRoutes(client.Context, *runtime.ServeMux) { + panic("unimplemented") +} + +// RegisterInterfaces implements module.AppModuleBasic. +func (a *AppModule) RegisterInterfaces(cdctypes.InterfaceRegistry) { + panic("unimplemented") +} + +// RegisterLegacyAminoCodec implements module.AppModuleBasic. +func (a *AppModule) RegisterLegacyAminoCodec(*codec.LegacyAmino) { + panic("unimplemented") +} + +func NewAppModule( + keeper keeper.Keeper, + bankKeeper bankkeeper.Keeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(), + keeper: keeper, + bankKeeper: bankKeeper, + } +} diff --git a/x/denommetadata/proposal_handler.go b/x/denommetadata/proposal_handler.go new file mode 100644 index 00000000..d517be14 --- /dev/null +++ b/x/denommetadata/proposal_handler.go @@ -0,0 +1,52 @@ +package denommetadata + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + "github.com/eve-network/eve/x/denommetadata/keeper" + "github.com/eve-network/eve/x/denommetadata/types" +) + +func NewDenomMetadataProposalHandler(k *keeper.Keeper) govtypes.Handler { + return func(ctx sdk.Context, content govtypes.Content) error { + switch c := content.(type) { + case *types.CreateDenomMetadataProposal: + return HandleCreateDenomMetadataProposal(ctx, k, c) + case *types.UpdateDenomMetadataProposal: + return HandleUpdateDenomMetadataProposal(ctx, k, c) + default: + return errorsmod.Wrapf(types.ErrUnknownRequest, "unrecognized denommetadata proposal content type: %T", c) + } + } +} + +// HandleCreateDenomMetadataProposal is a handler for executing a passed denom metadata creation proposal +func HandleCreateDenomMetadataProposal(ctx sdk.Context, k *keeper.Keeper, p *types.CreateDenomMetadataProposal) error { + if err := p.ValidateBasic(); err != nil { + return err + } + + for _, metadata := range p.TokenMetadata { + err := k.CreateDenomMetadata(ctx, metadata) + if err != nil { + return err + } + } + return nil +} + +// HandleUpdateDenomMetadataProposal is a handler for executing a passed denom metadata update proposal +func HandleUpdateDenomMetadataProposal(ctx sdk.Context, k *keeper.Keeper, p *types.UpdateDenomMetadataProposal) error { + if err := p.ValidateBasic(); err != nil { + return err + } + + for _, metadata := range p.TokenMetadata { + err := k.UpdateDenomMetadata(ctx, metadata) + if err != nil { + return err + } + } + return nil +} diff --git a/x/denommetadata/types/codec.go b/x/denommetadata/types/codec.go new file mode 100644 index 00000000..2fa8758a --- /dev/null +++ b/x/denommetadata/types/codec.go @@ -0,0 +1,35 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" +) + +var ( + amino = codec.NewLegacyAmino() +) + +// RegisterCodec registers the necessary x/denommetadata interfaces and concrete types on the provided +// LegacyAmino codec. These types are used for Amino JSON serialization. +func RegisterCodec(cdc *codec.LegacyAmino) { +} + +// RegisterInterfaces registers interfaces and implementations of the denommetadata module. +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*govtypes.Content)(nil), + &CreateDenomMetadataProposal{}, + &UpdateDenomMetadataProposal{}, + ) +} + +func init() { + RegisterCodec(amino) + // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be + // used to properly serialize MsgGrant and MsgExec instances + sdk.RegisterLegacyAminoCodec(amino) + + amino.Seal() +} diff --git a/x/denommetadata/types/errors.go b/x/denommetadata/types/errors.go new file mode 100644 index 00000000..9d5762ea --- /dev/null +++ b/x/denommetadata/types/errors.go @@ -0,0 +1,14 @@ +package types + +// DONTCOVER + +import ( + errorsmod "cosmossdk.io/errors" +) + +// x/denommetadata module sentinel errors +var ( + ErrDenomAlreadyExists = errorsmod.Register(ModuleName, 1000, "denom metadata is already registered") + ErrDenomDoesNotExist = errorsmod.Register(ModuleName, 1001, "unable to find denom metadata registered") + ErrUnknownRequest = errorsmod.Register(ModuleName, 1002, "unknown request") +) diff --git a/x/denommetadata/types/expected_keepers.go b/x/denommetadata/types/expected_keepers.go new file mode 100644 index 00000000..62885171 --- /dev/null +++ b/x/denommetadata/types/expected_keepers.go @@ -0,0 +1,33 @@ +package types + +import ( + "context" + + tmbytes "github.com/cometbft/cometbft/libs/bytes" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/ibc-go/v8/modules/core/exported" + rollapptypes "github.com/eve-network/eve/x/rollapp/types" +) + +// TransferKeeper defines the expected transfer keeper +type TransferKeeper interface { + HasDenomTrace(ctx sdk.Context, denomTraceHash tmbytes.HexBytes) bool +} + +// ChannelKeeper defines the expected IBC channel keeper +type ChannelKeeper interface { + GetChannelClientState(ctx sdk.Context, portID, channelID string) (string, exported.ClientState, error) +} + +// BankKeeper defines the expected interface needed +type BankKeeper interface { + HasDenomMetaData(ctx context.Context, denom string) bool + SetDenomMetaData(ctx context.Context, denomMetaData types.Metadata) +} + +type RollappKeeper interface { + GetParams(ctx sdk.Context) rollapptypes.Params + GetRollapp(ctx sdk.Context, chainID string) (rollapp rollapptypes.Rollapp, found bool) + RegisterDenomMetadata(ctx sdk.Context, rollapp rollapptypes.Rollapp, ibcBaseDenom, baseDenom string) +} diff --git a/x/denommetadata/types/genesis.go b/x/denommetadata/types/genesis.go new file mode 100644 index 00000000..50137fbf --- /dev/null +++ b/x/denommetadata/types/genesis.go @@ -0,0 +1,17 @@ +package types + +// this line is used by starport scaffolding # genesis/types/import + +// DefaultIndex is the default global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{} +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + return nil +} diff --git a/x/denommetadata/types/genesis.pb.go b/x/denommetadata/types/genesis.pb.go new file mode 100644 index 00000000..dc984108 --- /dev/null +++ b/x/denommetadata/types/genesis.pb.go @@ -0,0 +1,267 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/denommetadata/genesis.proto + +package types + +import ( + fmt "fmt" + 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 + +// GenesisState defines the denommetadata module's various parameters when first +// initialized +type GenesisState struct { +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_17deed591ae0179d, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func init() { + proto.RegisterType((*GenesisState)(nil), "nucleic.denommetadata.GenesisState") +} + +func init() { + proto.RegisterFile("nucleic/denommetadata/genesis.proto", fileDescriptor_17deed591ae0179d) +} + +var fileDescriptor_17deed591ae0179d = []byte{ + // 147 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xce, 0x2b, 0x4d, 0xce, + 0x49, 0xcd, 0x4c, 0xd6, 0x4f, 0x49, 0xcd, 0xcb, 0xcf, 0xcd, 0x4d, 0x2d, 0x49, 0x4c, 0x49, 0x2c, + 0x49, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, + 0x12, 0x85, 0x2a, 0xd2, 0x43, 0x51, 0xa4, 0xc4, 0xc7, 0xc5, 0xe3, 0x0e, 0x51, 0x17, 0x5c, 0x92, + 0x58, 0x92, 0xea, 0x14, 0x74, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, + 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x16, + 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x50, 0xb3, 0x74, 0xf3, 0x52, + 0x4b, 0xca, 0xf3, 0x8b, 0xb2, 0x61, 0x7c, 0xfd, 0x0a, 0x34, 0x27, 0x94, 0x54, 0x16, 0xa4, 0x16, + 0x27, 0xb1, 0x81, 0x5d, 0x60, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x3b, 0x41, 0x00, 0xd0, 0xa8, + 0x00, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/denommetadata/types/gov.pb.go b/x/denommetadata/types/gov.pb.go new file mode 100644 index 00000000..52587c76 --- /dev/null +++ b/x/denommetadata/types/gov.pb.go @@ -0,0 +1,677 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/denommetadata/gov.proto + +package types + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/x/bank/types" + _ "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 + +type CreateDenomMetadataProposal struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + TokenMetadata []types.Metadata `protobuf:"bytes,3,rep,name=token_metadata,json=tokenMetadata,proto3" json:"token_metadata"` +} + +func (m *CreateDenomMetadataProposal) Reset() { *m = CreateDenomMetadataProposal{} } +func (*CreateDenomMetadataProposal) ProtoMessage() {} +func (*CreateDenomMetadataProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_0d035e1e06df011d, []int{0} +} +func (m *CreateDenomMetadataProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateDenomMetadataProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CreateDenomMetadataProposal.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 *CreateDenomMetadataProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateDenomMetadataProposal.Merge(m, src) +} +func (m *CreateDenomMetadataProposal) XXX_Size() int { + return m.Size() +} +func (m *CreateDenomMetadataProposal) XXX_DiscardUnknown() { + xxx_messageInfo_CreateDenomMetadataProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateDenomMetadataProposal proto.InternalMessageInfo + +type UpdateDenomMetadataProposal struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + TokenMetadata []types.Metadata `protobuf:"bytes,3,rep,name=token_metadata,json=tokenMetadata,proto3" json:"token_metadata"` +} + +func (m *UpdateDenomMetadataProposal) Reset() { *m = UpdateDenomMetadataProposal{} } +func (*UpdateDenomMetadataProposal) ProtoMessage() {} +func (*UpdateDenomMetadataProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_0d035e1e06df011d, []int{1} +} +func (m *UpdateDenomMetadataProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UpdateDenomMetadataProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpdateDenomMetadataProposal.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 *UpdateDenomMetadataProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdateDenomMetadataProposal.Merge(m, src) +} +func (m *UpdateDenomMetadataProposal) XXX_Size() int { + return m.Size() +} +func (m *UpdateDenomMetadataProposal) XXX_DiscardUnknown() { + xxx_messageInfo_UpdateDenomMetadataProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_UpdateDenomMetadataProposal proto.InternalMessageInfo + +func init() { + proto.RegisterType((*CreateDenomMetadataProposal)(nil), "nucleic.denommetadata.CreateDenomMetadataProposal") + proto.RegisterType((*UpdateDenomMetadataProposal)(nil), "nucleic.denommetadata.UpdateDenomMetadataProposal") +} + +func init() { proto.RegisterFile("nucleic/denommetadata/gov.proto", fileDescriptor_0d035e1e06df011d) } + +var fileDescriptor_0d035e1e06df011d = []byte{ + // 296 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcf, 0x2b, 0x4d, 0xce, + 0x49, 0xcd, 0x4c, 0xd6, 0x4f, 0x49, 0xcd, 0xcb, 0xcf, 0xcd, 0x4d, 0x2d, 0x49, 0x4c, 0x49, 0x2c, + 0x49, 0xd4, 0x4f, 0xcf, 0x2f, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x85, 0x2a, 0xd0, + 0x43, 0x51, 0x20, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa1, 0x0f, 0x62, 0x41, 0x14, 0x4b, + 0xc9, 0x25, 0xe7, 0x17, 0xe7, 0xe6, 0x17, 0xeb, 0x27, 0x25, 0xe6, 0x65, 0xeb, 0x97, 0x19, 0x26, + 0xa5, 0x96, 0x24, 0x1a, 0x82, 0x39, 0x10, 0x79, 0xa5, 0xd5, 0x8c, 0x5c, 0xd2, 0xce, 0x45, 0xa9, + 0x89, 0x25, 0xa9, 0x2e, 0x20, 0xd3, 0x7c, 0xa1, 0xa6, 0x05, 0x14, 0xe5, 0x17, 0xe4, 0x17, 0x27, + 0xe6, 0x08, 0x89, 0x70, 0xb1, 0x96, 0x64, 0x96, 0xe4, 0xa4, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, + 0x06, 0x41, 0x38, 0x42, 0x0a, 0x5c, 0xdc, 0x29, 0xa9, 0xc5, 0xc9, 0x45, 0x99, 0x05, 0x25, 0x99, + 0xf9, 0x79, 0x12, 0x4c, 0x60, 0x39, 0x64, 0x21, 0x21, 0x2f, 0x2e, 0xbe, 0x92, 0xfc, 0xec, 0xd4, + 0xbc, 0x78, 0x98, 0xfb, 0x24, 0x98, 0x15, 0x98, 0x35, 0xb8, 0x8d, 0x64, 0xf5, 0x20, 0x0e, 0xd2, + 0x03, 0xbb, 0x01, 0xea, 0x20, 0x3d, 0x98, 0xb5, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0xf1, + 0x82, 0xb5, 0xc2, 0x04, 0xad, 0x38, 0x3a, 0x16, 0xc8, 0x33, 0xcc, 0x58, 0x20, 0xcf, 0x00, 0x76, + 0x6d, 0x68, 0x41, 0xca, 0xd0, 0x70, 0xad, 0x53, 0xd0, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, + 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, + 0xcb, 0x31, 0x44, 0x59, 0xa4, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, + 0x63, 0x53, 0x37, 0x2f, 0xb5, 0xa4, 0x3c, 0xbf, 0x28, 0x1b, 0xc6, 0xd7, 0xaf, 0x40, 0x4b, 0x00, + 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0x68, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, + 0x5a, 0x16, 0x99, 0x66, 0x26, 0x02, 0x00, 0x00, +} + +func (m *CreateDenomMetadataProposal) 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 *CreateDenomMetadataProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CreateDenomMetadataProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenMetadata) > 0 { + for iNdEx := len(m.TokenMetadata) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TokenMetadata[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintGov(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintGov(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *UpdateDenomMetadataProposal) 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 *UpdateDenomMetadataProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UpdateDenomMetadataProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenMetadata) > 0 { + for iNdEx := len(m.TokenMetadata) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TokenMetadata[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintGov(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintGov(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintGov(dAtA []byte, offset int, v uint64) int { + offset -= sovGov(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *CreateDenomMetadataProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if len(m.TokenMetadata) > 0 { + for _, e := range m.TokenMetadata { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + return n +} + +func (m *UpdateDenomMetadataProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if len(m.TokenMetadata) > 0 { + for _, e := range m.TokenMetadata { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + return n +} + +func sovGov(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGov(x uint64) (n int) { + return sovGov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *CreateDenomMetadataProposal) 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 ErrIntOverflowGov + } + 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: CreateDenomMetadataProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateDenomMetadataProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenMetadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenMetadata = append(m.TokenMetadata, types.Metadata{}) + if err := m.TokenMetadata[len(m.TokenMetadata)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UpdateDenomMetadataProposal) 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 ErrIntOverflowGov + } + 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: UpdateDenomMetadataProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpdateDenomMetadataProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenMetadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenMetadata = append(m.TokenMetadata, types.Metadata{}) + if err := m.TokenMetadata[len(m.TokenMetadata)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGov(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, ErrIntOverflowGov + } + 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, ErrIntOverflowGov + } + 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, ErrIntOverflowGov + } + 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, ErrInvalidLengthGov + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGov + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGov + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGov = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGov = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGov = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/denommetadata/types/hooks.go b/x/denommetadata/types/hooks.go new file mode 100644 index 00000000..ef0f86d2 --- /dev/null +++ b/x/denommetadata/types/hooks.go @@ -0,0 +1,42 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" +) + +// DenomMetadataHooks event hooks for denom metadata creation/update +type DenomMetadataHooks interface { + AfterDenomMetadataCreation(ctx sdk.Context, metadata banktypes.Metadata) error + AfterDenomMetadataUpdate(ctx sdk.Context, metadata banktypes.Metadata) error +} + +var _ DenomMetadataHooks = MultiDenomMetadataHooks{} + +// combine multiple DenomMetadata hooks, all hook functions are run in array sequence +type MultiDenomMetadataHooks []DenomMetadataHooks + +// Creates hooks for the DenomMetadata Module. +func NewMultiDenomMetadataHooks(hooks ...DenomMetadataHooks) MultiDenomMetadataHooks { + return hooks +} + +func (h MultiDenomMetadataHooks) AfterDenomMetadataCreation(ctx sdk.Context, metadata banktypes.Metadata) error { + for i := range h { + err := h[i].AfterDenomMetadataCreation(ctx, metadata) + if err != nil { + return err + } + } + return nil +} + +func (h MultiDenomMetadataHooks) AfterDenomMetadataUpdate(ctx sdk.Context, metadata banktypes.Metadata) error { + for i := range h { + err := h[i].AfterDenomMetadataUpdate(ctx, metadata) + if err != nil { + return err + } + } + return nil +} diff --git a/x/denommetadata/types/keys.go b/x/denommetadata/types/keys.go new file mode 100644 index 00000000..d8de3ca2 --- /dev/null +++ b/x/denommetadata/types/keys.go @@ -0,0 +1,12 @@ +package types + +var ( + // ModuleName defines the module name. + ModuleName = "denommetadata" + + // RouterKey is the message route for the denommetadata module + RouterKey = ModuleName + + // QuerierRoute defines the module's query routing key. + QuerierRoute = ModuleName +) diff --git a/x/denommetadata/types/proposal_metadata.go b/x/denommetadata/types/proposal_metadata.go new file mode 100644 index 00000000..6951934d --- /dev/null +++ b/x/denommetadata/types/proposal_metadata.go @@ -0,0 +1,123 @@ +package types + +import ( + "fmt" + "strings" + + "github.com/cosmos/cosmos-sdk/x/bank/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" +) + +const ( + // ProposalTypeCreateDenomMetadata defines the type for a CreateDenomMetadata + ProposalTypeCreateDenomMetadata = "CreateDenomMetadata" + + // ProposalTypeUpdateDenomMetadata defines the type for a UpdateDenomMetadata + ProposalTypeUpdateDenomMetadata = "UpdateDenomMetadata" +) + +// Assert CreateDenomMetadataProposal implements govtypes.Content at compile-time +var ( + _ govtypes.Content = &CreateDenomMetadataProposal{} + _ govtypes.Content = &UpdateDenomMetadataProposal{} +) + +func init() { + govtypes.RegisterProposalType(ProposalTypeCreateDenomMetadata) + govtypes.RegisterProposalType(ProposalTypeUpdateDenomMetadata) +} + +// NewCreateMetadataProposal creates a new create denommetadata proposal. +func NewCreateMetadataProposal(title, description string, denommetadata []types.Metadata) *CreateDenomMetadataProposal { + return &CreateDenomMetadataProposal{ + Title: title, + Description: description, + TokenMetadata: denommetadata, + } +} + +// GetTitle returns the title of a community pool spend proposal. +func (csp *CreateDenomMetadataProposal) GetTitle() string { return csp.Title } + +// GetDescription returns the description of a community pool spend proposal. +func (csp *CreateDenomMetadataProposal) GetDescription() string { return csp.Description } + +// ProposalRoute returns the routing key of a community pool spend proposal. +func (csp *CreateDenomMetadataProposal) ProposalRoute() string { return RouterKey } + +// ProposalType returns the type of a community pool spend proposal. +func (csp *CreateDenomMetadataProposal) ProposalType() string { return ProposalTypeCreateDenomMetadata } + +// ValidateBasic runs basic stateless validity checks +func (csp *CreateDenomMetadataProposal) ValidateBasic() error { + err := govtypes.ValidateAbstract(csp) + if err != nil { + return err + } + + for _, metadata := range csp.TokenMetadata { + err = metadata.Validate() + if err != nil { + return err + } + } + return nil +} + +// String implements the Stringer interface. +func (csp CreateDenomMetadataProposal) String() string { + var b strings.Builder + b.WriteString(fmt.Sprintf(`Create denommetadata Proposal: + Title: %s + Description: %s + TokenMetadata: %s +`, csp.Title, csp.Description, &csp.TokenMetadata)) + return b.String() +} + +// NewUpdateDenomMetadataProposal creates a new proposal for updating existing token metadata. +func NewUpdateDenomMetadataProposal(title, description string, denommetadata []types.Metadata) *UpdateDenomMetadataProposal { + return &UpdateDenomMetadataProposal{ + Title: title, + Description: description, + TokenMetadata: denommetadata, + } +} + +// GetTitle returns the title of a community pool spend proposal. +func (csp *UpdateDenomMetadataProposal) GetTitle() string { return csp.Title } + +// GetDescription returns the description of a community pool spend proposal. +func (csp *UpdateDenomMetadataProposal) GetDescription() string { return csp.Description } + +// ProposalRoute returns the routing key of a community pool spend proposal. +func (csp *UpdateDenomMetadataProposal) ProposalRoute() string { return RouterKey } + +// ProposalType returns the type of a community pool spend proposal. +func (csp *UpdateDenomMetadataProposal) ProposalType() string { return ProposalTypeCreateDenomMetadata } + +// ValidateBasic runs basic stateless validity checks +func (csp *UpdateDenomMetadataProposal) ValidateBasic() error { + err := govtypes.ValidateAbstract(csp) + if err != nil { + return err + } + for _, metadata := range csp.TokenMetadata { + err = metadata.Validate() + if err != nil { + return err + } + } + return nil +} + +// String implements the Stringer interface. +func (csp UpdateDenomMetadataProposal) String() string { + var b strings.Builder + b.WriteString(fmt.Sprintf(`Update denommetadata Proposal: + Title: %s + Description: %s + TokenMetadata: %s +`, csp.Title, csp.Description, &csp.TokenMetadata)) + return b.String() +} diff --git a/x/rollapp/README.md b/x/rollapp/README.md new file mode 100644 index 00000000..c0cdd622 --- /dev/null +++ b/x/rollapp/README.md @@ -0,0 +1,64 @@ +# x/rollapp + +## Abstract + +RollApps are standardized blockchains that are easy to bootstrap and provide a seamless user experience. RollApps come with pre-defined modules that expediate the development process, incorporating features such as minting native tokens, onchain governance, out-of-the-box bridging and much more. + +## Contents + +1. **[Concepts](#concepts)** +2. **[State](#state)** +3. **[Events](#events)** +4. **[Keepers](#keepers)** +5. **[Hooks](#hooks)** +6. **[Queries](#queries)** + +## Concepts + +This document specifies the rollapp module. + +This module allows rollapp register onto Nucleic chain. + +If a rollapp is registered on the Nucleic chain, sequencers should be able to nominate themselves for the rollapp by running a rollapp node. + +The Nucleic chain selects a sequencer for a block n blocks before. This is done through leader rotation based on restaked TIA signaled to each sequencer on that rollapp. + +## State + +Each RollApp is identified by a `rollapp_id` folows the same standard as cosmos `chain_id`. + +Here is a struct of a RollApp: + +```protobuf +message Rollapp { + string rollapp_id = 1; + string creator = 2; + // version is the software and configuration version. + // starts from 1 and increases by one on every MsgUpdateState + uint64 version = 3; + // max_sequencers is the maximum number of sequencers. + uint64 max_sequencers = 4; + // permissioned_addresses is a bech32-encoded address list of the sequencers + // that are allowed to serve this rollapp_id. In the case of an empty list, the + // rollapp is considered permissionless. + repeated string permissioned_addresses = 5; + // token_metadata is a list of TokenMetadata that are registered on this + // rollapp + repeated TokenMetadata token_metadata = 6; + // genesis_state is a partial repr of the state the hub can expect the rollapp + // to be in upon genesis + RollappGenesisState genesis_state = 7 [ (gogoproto.nullable) = false ]; + // channel_id will be set to the canonical IBC channel of the rollapp. + string channel_id = 8; + // frozen is a boolean that indicates if the rollapp is frozen. + bool frozen = 9; +} +``` + +## Events + +## Keepers + +## Hooks + +## Queries diff --git a/x/rollapp/client/cli/flags.go b/x/rollapp/client/cli/flags.go new file mode 100644 index 00000000..40e002df --- /dev/null +++ b/x/rollapp/client/cli/flags.go @@ -0,0 +1,18 @@ +package cli + +import "github.com/spf13/pflag" + +const ( + FlagStateIndex = "index" + FlagRollappHeight = "rollapp-height" + FlagFinalized = "finalized" + FlagGenesisAccountsPath = "genesis-accounts-path" +) + +// FlagSetCreateRollapp returns flags for creating gauges. +func FlagSetCreateRollapp() *pflag.FlagSet { + fs := pflag.NewFlagSet("", pflag.ContinueOnError) + + fs.String(FlagGenesisAccountsPath, "", "path to a json file containing genesis accounts") + return fs +} diff --git a/x/rollapp/client/cli/query.go b/x/rollapp/client/cli/query.go new file mode 100644 index 00000000..8ec1bd1c --- /dev/null +++ b/x/rollapp/client/cli/query.go @@ -0,0 +1,251 @@ +package cli + +import ( + "context" + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/eve-network/eve/x/rollapp/types" + "github.com/spf13/cobra" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// GetQueryCmd returns the cli query commands for this module +func GetQueryCmd(queryRoute string) *cobra.Command { + // Group markets queries under a subcommand + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdQueryParams()) + cmd.AddCommand(CmdQueryLatestHeight()) + cmd.AddCommand(CmdQueryLatestStateInfoIndex()) + cmd.AddCommand(CmdQueryStateInfo()) + cmd.AddCommand(CmdQueryRollapp()) + cmd.AddCommand(CmdQueryListRollapp()) + + return cmd +} + +func CmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "shows the parameters of the module", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdQueryLatestHeight() *cobra.Command { + cmd := &cobra.Command{ + Use: "latest-height [rollapp-id]", + Short: "Query the last height of the last UpdateState associated with the specified rollapp-id.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + argRollappId := args[0] + + argFinalized, err := cmd.Flags().GetBool(FlagFinalized) + if err != nil { + return err + } + + req := &types.QueryGetLatestHeightRequest{ + RollappId: argRollappId, + Finalized: argFinalized, + } + + res, err := queryClient.LatestHeight(context.Background(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + cmd.Flags().Bool(FlagFinalized, false, "Indicates whether to return the latest finalized state index") + + flags.AddQueryFlagsToCmd(cmd) + + return cmd + +} + +func CmdQueryLatestStateInfoIndex() *cobra.Command { + cmd := &cobra.Command{ + Use: "latest-state-index [rollapp-id]", + Short: "Query the index of the last UpdateState associated with the specified rollapp-id.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + argRollappId := args[0] + + argFinalized, err := cmd.Flags().GetBool(FlagFinalized) + if err != nil { + return err + } + + params := &types.QueryGetLatestStateIndexRequest{ + RollappId: argRollappId, + Finalized: argFinalized, + } + + res, err := queryClient.LatestStateIndex(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + cmd.Flags().Bool(FlagFinalized, false, "Indicates whether to return the latest finalized state index") + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdQueryListRollapp() *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "Query all rollapps currently registered in the hub", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryAllRollappRequest{ + Pagination: pageReq, + } + + res, err := queryClient.RollappAll(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdQueryRollapp() *cobra.Command { + cmd := &cobra.Command{ + Use: "show [rollapp-id]", + Short: "Query the rollapp associated with the specified rollapp-id", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + argRollappId := args[0] + + params := &types.QueryGetRollappRequest{ + RollappId: argRollappId, + } + + res, err := queryClient.Rollapp(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd + +} + +func CmdQueryStateInfo() *cobra.Command { + cmd := &cobra.Command{ + Use: "state [rollapp-id]", + Short: "Query the state associated with the specified rollapp-id and any other flags. If no flags are provided, return the latest state.", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + argRollappId := args[0] + + flagSet := cmd.Flags() + argIndex, err := flagSet.GetUint64(FlagStateIndex) + if err != nil { + return err + } + argHeight, err := flagSet.GetUint64(FlagRollappHeight) + if err != nil { + return err + } + argFinalized, err := flagSet.GetBool(FlagFinalized) + if err != nil { + return err + } + + if (argHeight != 0 && argIndex != 0) || (argHeight != 0 && argFinalized) || (argIndex != 0 && argFinalized) { + return status.Error(codes.InvalidArgument, fmt.Sprintf("only one flag can be use for %s, %s or %s", FlagStateIndex, FlagRollappHeight, FlagFinalized)) + } + + params := &types.QueryGetStateInfoRequest{ + RollappId: argRollappId, + Index: argIndex, + Height: argHeight, + Finalized: argFinalized, + } + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.StateInfo(context.Background(), params) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + + cmd.Flags().Uint64(FlagStateIndex, 0, "Use a specific state-index to query state-info at") + cmd.Flags().Uint64(FlagRollappHeight, 0, "Use a specific height of the rollapp to query state-info at") + cmd.Flags().Bool(FlagFinalized, false, "Indicates whether to return the latest finalized state") + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/rollapp/client/cli/tx.go b/x/rollapp/client/cli/tx.go new file mode 100644 index 00000000..8cd696a0 --- /dev/null +++ b/x/rollapp/client/cli/tx.go @@ -0,0 +1,142 @@ +package cli + +import ( + "encoding/json" + "fmt" + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/eve-network/eve/utils" + "github.com/eve-network/eve/x/rollapp/types" + "github.com/spf13/cast" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +type PermissionedAddresses struct { + Addresses []string `json:"addresses"` +} + +// GetTxCmd returns the transaction commands for this module +func GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdCreateRollapp()) + + return cmd +} + +func CmdCreateRollapp() *cobra.Command { + cmd := &cobra.Command{ + Use: "create-rollapp [rollapp-id] [max-sequencers] [permissioned-addresses] [metadata.json]", + Short: "Create a new rollapp", + Example: "nucleicd tx rollapp create-rollapp ROLLAPP_CHAIN_ID 10 '{\"Addresses\":[]}' metadata.json", + Args: cobra.RangeArgs(3, 4), + RunE: func(cmd *cobra.Command, args []string) (err error) { + argRollappId := args[0] + + argMaxSequencers, err := cast.ToUint64E(args[1]) + if err != nil { + return err + } + var argPermissionedAddresses PermissionedAddresses + if err := json.Unmarshal([]byte(args[2]), &argPermissionedAddresses); err != nil { + return err + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + // Parse metadata + var metadatas []types.TokenMetadata + if len(args) == 4 { + metadatas, err = utils.ParseJsonFromFile[types.TokenMetadata](args[3]) + if err != nil { + return err + } + } + // Parse genesis accounts + genesisAccountsPath, _ := cmd.Flags().GetString(FlagGenesisAccountsPath) + genesisAccounts, err := utils.ParseJsonFromFile[types.GenesisAccount](genesisAccountsPath) + if err != nil && genesisAccountsPath != "" { + return err + } + + msg := types.NewMsgCreateRollapp( + clientCtx.GetFromAddress().String(), + argRollappId, + argMaxSequencers, + argPermissionedAddresses.Addresses, + metadatas, + genesisAccounts, + ) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + cmd.Flags().AddFlagSet(FlagSetCreateRollapp()) + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +func CmdUpdateState() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-state [rollapp-id] [start-height] [num-blocks] [da-path] [version] [block-desc]", + Short: "Update rollapp state", + Args: cobra.ExactArgs(6), + RunE: func(cmd *cobra.Command, args []string) (err error) { + argRollappId := args[0] + argStartHeight, err := cast.ToUint64E(args[1]) + if err != nil { + return err + } + argNumBlocks, err := cast.ToUint64E(args[2]) + if err != nil { + return err + } + argDAPath := args[3] + argVersion, err := cast.ToUint64E(args[4]) + if err != nil { + return err + } + argBlockDescs := new(types.BlockDescriptors) + err = json.Unmarshal([]byte(args[5]), argBlockDescs) + if err != nil { + return err + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgUpdateState( + clientCtx.GetFromAddress().String(), + argRollappId, + argStartHeight, + argNumBlocks, + argDAPath, + argVersion, + argBlockDescs, + ) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/rollapp/genesis.go b/x/rollapp/genesis.go new file mode 100644 index 00000000..c6e7c1b6 --- /dev/null +++ b/x/rollapp/genesis.go @@ -0,0 +1,41 @@ +package rollapp + +import ( + "github.com/eve-network/eve/x/rollapp/keeper" + "github.com/eve-network/eve/x/rollapp/types" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// InitGenesis initializes the capability module's state from a provided genesis +// state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + k.SetParams(ctx, genState.Params) + // Validate all other genesis fields are empty + genesisFields := []int{ + len(genState.RollappList), + len(genState.StateInfoList), + len(genState.LatestStateInfoIndexList), + len(genState.LatestFinalizedStateIndexList), + len(genState.BlockHeightToFinalizationQueueList), + } + for _, fieldLength := range genesisFields { + if fieldLength != 0 { + panic("Only params can be initialized at genesis") + } + } +} + +// ExportGenesis returns the capability module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) + + genesis.RollappList = k.GetAllRollapps(ctx) + genesis.StateInfoList = k.GetAllStateInfo(ctx) + genesis.LatestStateInfoIndexList = k.GetAllLatestStateInfoIndex(ctx) + genesis.LatestFinalizedStateIndexList = k.GetAllLatestFinalizedStateIndex(ctx) + genesis.BlockHeightToFinalizationQueueList = k.GetAllBlockHeightToFinalizationQueue(ctx) + + return genesis +} diff --git a/x/rollapp/keeper/block_height_to_finalization_queue.go b/x/rollapp/keeper/block_height_to_finalization_queue.go new file mode 100644 index 00000000..4173ed8f --- /dev/null +++ b/x/rollapp/keeper/block_height_to_finalization_queue.go @@ -0,0 +1,125 @@ +package keeper + +import ( + "fmt" + + "github.com/eve-network/eve/x/rollapp/types" + + "cosmossdk.io/store/prefix" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// FinalizeQueue is called every block to finalize states when their dispute period over. +func (k Keeper) FinalizeQueue(ctx sdk.Context) error { + if uint64(ctx.BlockHeight()) < k.DisputePeriodInBlocks(ctx) { + return nil + } + // TODO: need implement this + return nil +} + +func (k Keeper) finalizePending(ctx sdk.Context, pendingFinalizationQueue []types.BlockHeightToFinalizationQueue) error { + // Iterate over all the pending finalization queue + for _, blockHeightToFinalizationQueue := range pendingFinalizationQueue { + // finalize pending states + for _, stateInfoIndex := range blockHeightToFinalizationQueue.FinalizationQueue { + stateInfo := k.MustGetStateInfo(ctx, stateInfoIndex.RollappId, stateInfoIndex.Index) + if stateInfo.Status != types.Status_PENDING { + panic(fmt.Sprintf("invariant broken: stateInfo is not in pending state: rollapp: %s: status: %s", stateInfoIndex.RollappId, stateInfo.Status)) + } + stateInfo.Finalize() + // update the status of the stateInfo + k.SetStateInfo(ctx, stateInfo) + // update the LatestStateInfoIndex of the rollapp + k.SetLatestFinalizedStateIndex(ctx, stateInfoIndex) + // call the after-update-state hook + keeperHooks := k.GetHooks() + err := keeperHooks.AfterStateFinalized(ctx, stateInfoIndex.RollappId, &stateInfo) + if err != nil { + return fmt.Errorf("after state finalized: %w", err) + } + + // emit event + ctx.EventManager().EmitEvent( + sdk.NewEvent(types.EventTypeStateUpdate, + stateInfo.GetEvents()..., + ), + ) + } + k.RemoveBlockHeightToFinalizationQueue(ctx, blockHeightToFinalizationQueue.CreationHeight) + } + return nil +} + +// SetBlockHeightToFinalizationQueue set a specific blockHeightToFinalizationQueue in the store from its index +func (k Keeper) SetBlockHeightToFinalizationQueue(ctx sdk.Context, blockHeightToFinalizationQueue types.BlockHeightToFinalizationQueue) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeightToFinalizationQueueKeyPrefix)) + b := k.cdc.MustMarshal(&blockHeightToFinalizationQueue) + store.Set(types.BlockHeightToFinalizationQueueKey( + blockHeightToFinalizationQueue.CreationHeight, + ), b) +} + +// GetBlockHeightToFinalizationQueue returns a blockHeightToFinalizationQueue from its index +func (k Keeper) GetBlockHeightToFinalizationQueue( + ctx sdk.Context, + creationHeight uint64, +) (val types.BlockHeightToFinalizationQueue, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeightToFinalizationQueueKeyPrefix)) + + b := store.Get(types.BlockHeightToFinalizationQueueKey( + creationHeight, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveBlockHeightToFinalizationQueue removes a blockHeightToFinalizationQueue from the store +func (k Keeper) RemoveBlockHeightToFinalizationQueue( + ctx sdk.Context, + creationHeight uint64, +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeightToFinalizationQueueKeyPrefix)) + store.Delete(types.BlockHeightToFinalizationQueueKey( + creationHeight, + )) +} + +// GetAllFinalizationQueueUntilHeight returns all the blockHeightToFinalizationQueues with creation height equal or less to the input height +func (k Keeper) GetAllFinalizationQueueUntilHeight(ctx sdk.Context, height uint64) (list []types.BlockHeightToFinalizationQueue) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeightToFinalizationQueueKeyPrefix)) + iterator := store.Iterator(nil, nil) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.BlockHeightToFinalizationQueue + k.cdc.MustUnmarshal(iterator.Value(), &val) + if height < val.CreationHeight { + break + } + list = append(list, val) + } + + return +} + +// GetAllBlockHeightToFinalizationQueue returns all blockHeightToFinalizationQueue +func (k Keeper) GetAllBlockHeightToFinalizationQueue(ctx sdk.Context) (list []types.BlockHeightToFinalizationQueue) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeightToFinalizationQueueKeyPrefix)) + iterator := store.Iterator(nil, nil) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.BlockHeightToFinalizationQueue + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/rollapp/keeper/grpc_query.go b/x/rollapp/keeper/grpc_query.go new file mode 100644 index 00000000..d6268983 --- /dev/null +++ b/x/rollapp/keeper/grpc_query.go @@ -0,0 +1,354 @@ +package keeper + +import ( + "context" + + "github.com/eve-network/eve/x/rollapp/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/store/prefix" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" +) + +var _ types.QueryServer = Keeper{} + +// LatestHeight implements types.QueryServer. +func (k Keeper) LatestHeight(c context.Context, req *types.QueryGetLatestHeightRequest) (*types.QueryGetLatestHeightResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + var val types.StateInfoIndex + var found bool + if req.Finalized { + val, found = k.GetLatestFinalizedStateIndex( + ctx, + req.RollappId, + ) + } else { + val, found = k.GetLatestStateInfoIndex( + ctx, + req.RollappId, + ) + } + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + state := k.MustGetStateInfo(ctx, req.RollappId, val.Index) + + return &types.QueryGetLatestHeightResponse{ + Height: state.GetLatestHeight(), + }, nil +} + +// LatestStateIndex implements types.QueryServer. +func (k Keeper) LatestStateIndex(c context.Context, req *types.QueryGetLatestStateIndexRequest) (*types.QueryGetLatestStateIndexResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + var val types.StateInfoIndex + var found bool + if req.Finalized { + val, found = k.GetLatestFinalizedStateIndex( + ctx, + req.RollappId, + ) + } else { + val, found = k.GetLatestStateInfoIndex( + ctx, + req.RollappId, + ) + } + + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryGetLatestStateIndexResponse{StateIndex: val}, nil +} + +// Params implements types.QueryServer. +func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil +} + +// Rollapp implements types.QueryServer. +func (k Keeper) Rollapp(c context.Context, req *types.QueryGetRollappRequest) (*types.QueryGetRollappResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetRollapp( + ctx, + req.RollappId, + ) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + rollappResponse := &types.QueryGetRollappResponse{Rollapp: val} + latestStateInfoIndex, found := k.GetLatestStateInfoIndex(ctx, val.RollappId) + if found { + rollappResponse.LatestStateIndex = &latestStateInfoIndex + } + latestFinalizedStateInfoIndex, found := k.GetLatestFinalizedStateIndex(ctx, val.RollappId) + if found { + rollappResponse.LatestFinalizedStateIndex = &latestFinalizedStateInfoIndex + } + + return rollappResponse, nil +} + +// RollappAll implements types.QueryServer. +func (k Keeper) RollappAll(c context.Context, req *types.QueryAllRollappRequest) (*types.QueryAllRollappResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var rollapps []types.RollappSummary + ctx := sdk.UnwrapSDKContext(c) + + store := ctx.KVStore(k.storeKey) + rollappStore := prefix.NewStore(store, types.KeyPrefix(types.RollappKeyPrefix)) + + pageRes, err := query.Paginate(rollappStore, req.Pagination, func(key, value []byte) error { + var rollapp types.Rollapp + if err := k.cdc.Unmarshal(value, &rollapp); err != nil { + return err + } + rollappSummary := types.RollappSummary{ + RollappId: rollapp.RollappId, + } + latestStateInfoIndex, found := k.GetLatestStateInfoIndex(ctx, rollapp.RollappId) + if found { + rollappSummary.LatestStateIndex = &latestStateInfoIndex + } + latestFinalizedStateInfoIndex, found := k.GetLatestFinalizedStateIndex(ctx, rollapp.RollappId) + if found { + rollappSummary.LatestFinalizedStateIndex = &latestFinalizedStateInfoIndex + } + + rollapps = append(rollapps, rollappSummary) + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllRollappResponse{Rollapp: rollapps, Pagination: pageRes}, nil +} + +// RollappByEIP155 implements types.QueryServer. +func (k Keeper) RollappByEIP155(c context.Context, req *types.QueryGetRollappByEIP155Request) (*types.QueryGetRollappResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetRollappByEIP155( + ctx, + req.Eip155, + ) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + rollappResponse := &types.QueryGetRollappResponse{Rollapp: val} + latestStateInfoIndex, found := k.GetLatestStateInfoIndex(ctx, val.RollappId) + if found { + rollappResponse.LatestStateIndex = &latestStateInfoIndex + } + latestFinalizedStateInfoIndex, found := k.GetLatestFinalizedStateIndex(ctx, val.RollappId) + if found { + rollappResponse.LatestFinalizedStateIndex = &latestFinalizedStateInfoIndex + } + + return rollappResponse, nil +} + +// StateInfo implements types.QueryServer. +func (k Keeper) StateInfo(c context.Context, req *types.QueryGetStateInfoRequest) (*types.QueryGetStateInfoResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(c) + + if req.Height == 0 && req.Index == 0 { + if req.Finalized { + latestFinalizedStateIndex, found := k.GetLatestFinalizedStateIndex(ctx, req.RollappId) + if !found { + return nil, errorsmod.Wrapf(types.ErrNoFinalizedStateYetForRollapp, + "LatestFinalizedStateIndex wasn't found for rollappId=%s", req.RollappId) + } + req.Index = latestFinalizedStateIndex.Index + } else { + latestStateIndex, found := k.GetLatestStateInfoIndex(ctx, req.RollappId) + if !found { + if _, exists := k.GetRollapp(ctx, req.RollappId); !exists { + return nil, types.ErrRollappNotRegistered + } + return nil, status.Error(codes.NotFound, "not found") + } + req.Index = latestStateIndex.Index + } + } + + var stateInfo types.StateInfo + if req.Index != 0 { + val, found := k.GetStateInfo(ctx, req.RollappId, req.Index) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + stateInfo = val + } else if req.Height != 0 { + val, err := k.FindStateInfoByHeight(ctx, req.RollappId, req.Height) + if err != nil { + return nil, err + } + stateInfo = *val + } + + return &types.QueryGetStateInfoResponse{StateInfo: stateInfo}, nil +} + +func (k Keeper) FindStateInfoByHeight(ctx sdk.Context, rollappId string, height uint64) (*types.StateInfo, error) { + // check that height not zero + if height == 0 { + return nil, types.ErrInvalidHeight + } + + _, found := k.GetRollapp(ctx, rollappId) + if !found { + return nil, types.ErrUnknownRollappID + } + + stateInfoIndex, found := k.GetLatestStateInfoIndex(ctx, rollappId) + if !found { + return nil, errorsmod.Wrapf(types.ErrNotFound, + "LatestStateInfoIndex wasn't found for rollappId=%s", + rollappId) + } + // initial interval to search in + startInfoIndex := uint64(1) // see TODO bellow + endInfoIndex := stateInfoIndex.Index + + // get state info + LatestStateInfo, found := k.GetStateInfo(ctx, rollappId, endInfoIndex) + if !found { + return nil, errorsmod.Wrapf(types.ErrNotFound, + "StateInfo wasn't found for rollappId=%s, index=%d", + rollappId, endInfoIndex) + } + + // check that height exists + if height >= LatestStateInfo.StartHeight+LatestStateInfo.NumBlocks { + return nil, errorsmod.Wrapf(types.ErrStateNotExists, + "rollappId=%s, height=%d", + rollappId, height) + } + + // check if the height belongs to this batch + if height >= LatestStateInfo.StartHeight { + return &LatestStateInfo, nil + } + + maxNumberOfSteps := endInfoIndex - startInfoIndex + 1 + stepNum := uint64(0) + for ; stepNum < maxNumberOfSteps; stepNum += 1 { + // we know that endInfoIndex > startInfoIndex + // otherwise the height should have been found + if endInfoIndex <= startInfoIndex { + return nil, errorsmod.Wrapf(types.ErrLogic, + "endInfoIndex should be != than startInfoIndex rollappId=%s, startInfoIndex=%d, endInfoIndex=%d", + rollappId, startInfoIndex, endInfoIndex) + } + // 1. get state info + startStateInfo, found := k.GetStateInfo(ctx, rollappId, startInfoIndex) + if !found { + // TODO: + // if stateInfo is missing it won't be logic error if history deletion be implemented + // for that we will have to check the oldest we have + return nil, errorsmod.Wrapf(types.ErrNotFound, + "StateInfo wasn't found for rollappId=%s, index=%d", + rollappId, startInfoIndex) + } + endStateInfo, found := k.GetStateInfo(ctx, rollappId, endInfoIndex) + if !found { + return nil, errorsmod.Wrapf(types.ErrNotFound, + "StateInfo wasn't found for rollappId=%s, index=%d", + rollappId, endInfoIndex) + } + startHeight := startStateInfo.StartHeight + endHeight := endStateInfo.StartHeight + endStateInfo.NumBlocks - 1 + + // 2. check startStateInfo + if height >= startStateInfo.StartHeight && + (startStateInfo.StartHeight+startStateInfo.NumBlocks) > height { + return &startStateInfo, nil + } + + // 3. check endStateInfo + if height >= endStateInfo.StartHeight && + (endStateInfo.StartHeight+endStateInfo.NumBlocks) > height { + return &endStateInfo, nil + } + + // 4. calculate the average blocks per batch + avgBlocksPerBatch := (endHeight - startHeight + 1) / (endInfoIndex - startInfoIndex + 1) + if avgBlocksPerBatch == 0 { + return nil, errorsmod.Wrapf(types.ErrLogic, + "avgBlocksPerBatch is zero!!! rollappId=%s, endHeight=%d, startHeight=%d, endInfoIndex=%d, startInfoIndex=%d", + rollappId, endHeight, startHeight, endInfoIndex, startInfoIndex) + } + + // 5. load the candidate block batch + infoIndexStep := (height - startHeight) / avgBlocksPerBatch + if infoIndexStep == 0 { + infoIndexStep = 1 + } + candidateInfoIndex := startInfoIndex + infoIndexStep + if candidateInfoIndex > endInfoIndex { + // skip to the last, probably the steps to big + candidateInfoIndex = endInfoIndex + } + if candidateInfoIndex == endInfoIndex { + candidateInfoIndex = endInfoIndex - 1 + } + candidateStateInfo, found := k.GetStateInfo(ctx, rollappId, candidateInfoIndex) + if !found { + return nil, errorsmod.Wrapf(types.ErrNotFound, + "StateInfo wasn't found for rollappId=%s, index=%d", + rollappId, candidateInfoIndex) + } + + // 6. check the candidate + if candidateStateInfo.StartHeight > height { + endInfoIndex = candidateInfoIndex - 1 + } else { + if candidateStateInfo.StartHeight+candidateStateInfo.NumBlocks-1 < height { + startInfoIndex = candidateInfoIndex + 1 + } else { + return &candidateStateInfo, nil + } + } + } + + return nil, errorsmod.Wrapf(types.ErrLogic, + "More searching steps than indexes! rollappId=%s, stepNum=%d, maxNumberOfSteps=%d", + rollappId, stepNum, maxNumberOfSteps) +} diff --git a/x/rollapp/keeper/keeper.go b/x/rollapp/keeper/keeper.go new file mode 100644 index 00000000..9fe6b17f --- /dev/null +++ b/x/rollapp/keeper/keeper.go @@ -0,0 +1,183 @@ +package keeper + +import ( + "fmt" + + "github.com/eve-network/eve/utils" + "github.com/eve-network/eve/x/rollapp/types" + + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +type Keeper struct { + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + memKey storetypes.StoreKey + hooks types.MultiRollappHooks + paramstore paramtypes.Subspace + + ibcclientKeeper types.IBCClientKeeper + transferKeeper types.TransferKeeper + channelKeeper types.ChannelKeeper + bankKeeper types.BankKeeper + denommetadataKeeper types.DenomMetadataKeeper + + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string +} + +func NewKeeper( + cdc codec.BinaryCodec, + storeKey, + memKey storetypes.StoreKey, + ps paramtypes.Subspace, + ibcclientKeeper types.IBCClientKeeper, + transferKeeper types.TransferKeeper, + channelKeeper types.ChannelKeeper, + bankKeeper types.BankKeeper, + denommetadataKeeper types.DenomMetadataKeeper, + authority string, +) *Keeper { + return &Keeper{ + cdc: cdc, + storeKey: storeKey, + memKey: memKey, + paramstore: ps, + hooks: nil, + ibcclientKeeper: ibcclientKeeper, + transferKeeper: transferKeeper, + channelKeeper: channelKeeper, + bankKeeper: bankKeeper, + denommetadataKeeper: denommetadataKeeper, + authority: authority, + } +} + +// GetAuthority returns the module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} + +// Logger returns a module-specific logger. +func (k *Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} + +// TriggerRollappGenesisEvent triggers the genesis event for the rollapp. +func (k Keeper) TriggerRollappGenesisEvent(ctx sdk.Context, rollapp types.Rollapp) error { + // Validate it hasn't been triggered yet + if rollapp.GenesisState.IsGenesisEvent { + return types.ErrGenesisEventAlreadyTriggered + } + + if err := k.registerDenomMetadata(ctx, rollapp); err != nil { + return errorsmod.Wrapf(types.ErrRegisterDenomMetadataFailed, "register denom metadata: %s", err) + } + + if err := k.mintRollappGenesisTokens(ctx, rollapp); err != nil { + return errorsmod.Wrapf(types.ErrMintTokensFailed, "mint rollapp genesis tokens: %s", err) + } + + rollapp.GenesisState.IsGenesisEvent = true + k.SetRollapp(ctx, rollapp) + return nil +} + +// registerDenomMetadata registers the denom metadata for the IBC token +func (k Keeper) registerDenomMetadata(ctx sdk.Context, rollapp types.Rollapp) error { + for i := range rollapp.TokenMetadata { + denomTrace := utils.GetForeignDenomTrace(rollapp.ChannelId, rollapp.TokenMetadata[i].Base) + traceHash := denomTrace.Hash() + // if the denom trace does not exist, add it + if !k.transferKeeper.HasDenomTrace(ctx, traceHash) { + k.transferKeeper.SetDenomTrace(ctx, denomTrace) + } + + ibcBaseDenom := denomTrace.IBCDenom() + + // create a new token denom metadata where it's base = ibcDenom, + // and the rest of the fields are taken from rollapp.metadata + metadata := banktypes.Metadata{ + Description: "auto-generated metadata for " + ibcBaseDenom + " from rollapp " + rollapp.RollappId, + Base: ibcBaseDenom, + DenomUnits: make([]*banktypes.DenomUnit, len(rollapp.TokenMetadata[i].DenomUnits)), + Display: rollapp.TokenMetadata[i].Display, + Name: rollapp.TokenMetadata[i].Name, + Symbol: rollapp.TokenMetadata[i].Symbol, + URI: rollapp.TokenMetadata[i].URI, + URIHash: rollapp.TokenMetadata[i].URIHash, + } + // Copy DenomUnits slice + for j, du := range rollapp.TokenMetadata[i].DenomUnits { + newDu := banktypes.DenomUnit{ + Aliases: du.Aliases, + Denom: du.Denom, + Exponent: du.Exponent, + } + // base denom_unit should be the same as baseDenom + if newDu.Exponent == 0 { + newDu.Denom = ibcBaseDenom + newDu.Aliases = append(newDu.Aliases, du.Denom) + } + metadata.DenomUnits[j] = &newDu + } + + // validate metadata + if validity := metadata.Validate(); validity != nil { + return fmt.Errorf("invalid denom metadata on genesis event: %w", validity) + } + + // save the new token denom metadata + if err := k.denommetadataKeeper.CreateDenomMetadata(ctx, metadata); err != nil { + return fmt.Errorf("create denom metadata: %w", err) + } + + k.Logger(ctx).Info("registered denom metadata for IBC token", "rollappID", rollapp.RollappId, "denom", ibcBaseDenom) + } + return nil +} + +func (k Keeper) mintRollappGenesisTokens(ctx sdk.Context, rollapp types.Rollapp) error { + for _, acc := range rollapp.GenesisState.GenesisAccounts { + ibcBaseDenom := utils.GetForeignDenomTrace(rollapp.ChannelId, acc.Amount.Denom).IBCDenom() + coinsToMint := sdk.NewCoins(sdk.NewCoin(ibcBaseDenom, acc.Amount.Amount)) + + if err := k.bankKeeper.MintCoins(ctx, types.ModuleName, coinsToMint); err != nil { + return fmt.Errorf("mint coins: %w", err) + } + + accAddress, err := sdk.AccAddressFromBech32(acc.Address) + if err != nil { + return fmt.Errorf("convert account address: %w", err) + } + + if err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, accAddress, coinsToMint); err != nil { + return fmt.Errorf("send coins to account: %w", err) + } + } + return nil +} + +/* -------------------------------------------------------------------------- */ +/* Hooks */ +/* -------------------------------------------------------------------------- */ + +// Set the rollapp hooks +func (k *Keeper) SetHooks(sh types.MultiRollappHooks) { + if k.hooks != nil { + panic("cannot set rollapp hooks twice") + } + k.hooks = sh +} + +func (k *Keeper) GetHooks() types.MultiRollappHooks { + return k.hooks +} diff --git a/x/rollapp/keeper/latest_finalized_state_index.go b/x/rollapp/keeper/latest_finalized_state_index.go new file mode 100644 index 00000000..8784f718 --- /dev/null +++ b/x/rollapp/keeper/latest_finalized_state_index.go @@ -0,0 +1,65 @@ +package keeper + +import ( + "github.com/eve-network/eve/x/rollapp/types" + + "cosmossdk.io/store/prefix" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// LatestFinalizedStateIndex defines the rollapps' current (latest) index of the latest StateInfo that was finalized + +// SetLatestFinalizedStateIndex set a specific latestFinalizedStateIndex in the store from its index +func (k Keeper) SetLatestFinalizedStateIndex(ctx sdk.Context, latestFinalizedStateIndex types.StateInfoIndex) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestFinalizedStateIndexKeyPrefix)) + b := k.cdc.MustMarshal(&latestFinalizedStateIndex) + store.Set(types.LatestFinalizedStateIndexKey( + latestFinalizedStateIndex.RollappId, + ), b) +} + +// GetLatestFinalizedStateIndex returns a latestFinalizedStateIndex from its index +func (k Keeper) GetLatestFinalizedStateIndex( + ctx sdk.Context, + rollappId string, +) (val types.StateInfoIndex, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestFinalizedStateIndexKeyPrefix)) + + b := store.Get(types.LatestFinalizedStateIndexKey( + rollappId, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveLatestFinalizedStateIndex removes a latestFinalizedStateIndex from the store +func (k Keeper) RemoveLatestFinalizedStateIndex( + ctx sdk.Context, + rollappId string, +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestFinalizedStateIndexKeyPrefix)) + store.Delete(types.LatestFinalizedStateIndexKey( + rollappId, + )) +} + +// GetAllLatestFinalizedStateIndex returns all latestFinalizedStateIndex +func (k Keeper) GetAllLatestFinalizedStateIndex(ctx sdk.Context) (list []types.StateInfoIndex) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestFinalizedStateIndexKeyPrefix)) + iterator := store.Iterator(nil, nil) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.StateInfoIndex + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/rollapp/keeper/latest_state_info_index.go b/x/rollapp/keeper/latest_state_info_index.go new file mode 100644 index 00000000..1d5d7d8c --- /dev/null +++ b/x/rollapp/keeper/latest_state_info_index.go @@ -0,0 +1,65 @@ +package keeper + +import ( + "github.com/eve-network/eve/x/rollapp/types" + + "cosmossdk.io/store/prefix" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// LatestStateInfoIndex defines the rollapps' current (latest) index of the last UpdateState + +// SetLatestStateInfoIndex set a specific latestStateInfoIndex in the store from its index +func (k Keeper) SetLatestStateInfoIndex(ctx sdk.Context, latestStateInfoIndex types.StateInfoIndex) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestStateInfoIndexKeyPrefix)) + b := k.cdc.MustMarshal(&latestStateInfoIndex) + store.Set(types.LatestStateInfoIndexKey( + latestStateInfoIndex.RollappId, + ), b) +} + +// GetLatestStateInfoIndex returns a latestStateInfoIndex from its index +func (k Keeper) GetLatestStateInfoIndex( + ctx sdk.Context, + rollappId string, +) (val types.StateInfoIndex, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestStateInfoIndexKeyPrefix)) + + b := store.Get(types.LatestStateInfoIndexKey( + rollappId, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveLatestStateInfoIndex removes a latestStateInfoIndex from the store +func (k Keeper) RemoveLatestStateInfoIndex( + ctx sdk.Context, + rollappId string, +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestStateInfoIndexKeyPrefix)) + store.Delete(types.LatestStateInfoIndexKey( + rollappId, + )) +} + +// GetAllLatestStateInfoIndex returns all latestStateInfoIndex +func (k Keeper) GetAllLatestStateInfoIndex(ctx sdk.Context) (list []types.StateInfoIndex) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LatestStateInfoIndexKeyPrefix)) + iterator := store.Iterator(nil, nil) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.StateInfoIndex + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/rollapp/keeper/msg_server.go b/x/rollapp/keeper/msg_server.go new file mode 100644 index 00000000..3cee49b5 --- /dev/null +++ b/x/rollapp/keeper/msg_server.go @@ -0,0 +1,34 @@ +package keeper + +import ( + "context" + + "github.com/eve-network/eve/x/rollapp/types" +) + +type msgServer struct { + Keeper +} + +// CreateRollapp implements types.MsgServer. +func (m msgServer) CreateRollapp(context.Context, *types.MsgCreateRollapp) (*types.MsgCreateRollappResponse, error) { + panic("unimplemented") +} + +// TriggerGenesisEvent implements types.MsgServer. +func (m msgServer) TriggerGenesisEvent(context.Context, *types.MsgRollappGenesisEvent) (*types.MsgRollappGenesisEventResponse, error) { + panic("unimplemented") +} + +// UpdateState implements types.MsgServer. +func (m msgServer) UpdateState(context.Context, *types.MsgUpdateState) (*types.MsgUpdateStateResponse, error) { + panic("unimplemented") +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/x/rollapp/keeper/params.go b/x/rollapp/keeper/params.go new file mode 100644 index 00000000..bc5eb178 --- /dev/null +++ b/x/rollapp/keeper/params.go @@ -0,0 +1,48 @@ +package keeper + +import ( + "github.com/eve-network/eve/x/rollapp/types" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx sdk.Context) types.Params { + return types.NewParams( + k.RollappsEnabled(ctx), + k.DisputePeriodInBlocks(ctx), + k.DeployerWhitelist(ctx), + ) +} + +// SetParams set the params +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + k.paramstore.SetParamSet(ctx, ¶ms) +} + +// DisputePeriodInBlocks returns the DisputePeriodInBlocks param +func (k Keeper) DisputePeriodInBlocks(ctx sdk.Context) (res uint64) { + k.paramstore.Get(ctx, types.KeyDisputePeriodInBlocks, &res) + return +} + +// DeployerWhitelist returns the DeployerWhitelist param +func (k Keeper) DeployerWhitelist(ctx sdk.Context) (res []types.DeployerParams) { + k.paramstore.Get(ctx, types.KeyDeployerWhitelist, &res) + return +} + +func (k Keeper) RollappsEnabled(ctx sdk.Context) (res bool) { + k.paramstore.Get(ctx, types.KeyRollappsEnabled, &res) + return +} + +func (k Keeper) IsAddressInDeployerWhiteList(ctx sdk.Context, address string) bool { + whitelist := k.DeployerWhitelist(ctx) + for _, item := range whitelist { + if item.Address == address { + return true + } + } + return false +} diff --git a/x/rollapp/keeper/rollapp.go b/x/rollapp/keeper/rollapp.go new file mode 100644 index 00000000..1390dbc2 --- /dev/null +++ b/x/rollapp/keeper/rollapp.go @@ -0,0 +1,99 @@ +package keeper + +import ( + "github.com/eve-network/eve/x/rollapp/types" + + "cosmossdk.io/store/prefix" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// SetRollapp set a specific rollapp in the store from its index +func (k Keeper) SetRollapp(ctx sdk.Context, rollapp types.Rollapp) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.RollappKeyPrefix)) + b := k.cdc.MustMarshal(&rollapp) + store.Set(types.RollappKey( + rollapp.RollappId, + ), b) + + // check if chain-id is EVM compatible. no err check as rollapp is already validated + rollappID, _ := types.NewChainID(rollapp.RollappId) + if !rollappID.IsEIP155() { + return + } + + // In case the chain id is EVM compatible, we store it by EIP155 id, to be retrievable by EIP155 id key + store = prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.RollappByEIP155KeyPrefix)) + store.Set(types.RollappByEIP155Key( + rollappID.GetEIP155ID(), + ), b) +} + +// GetRollappByEIP155 returns a rollapp from its EIP155 id (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md) for EVM compatible rollapps +func (k Keeper) GetRollappByEIP155( + ctx sdk.Context, + eip155 uint64, +) (val types.Rollapp, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.RollappByEIP155KeyPrefix)) + + b := store.Get(types.RollappByEIP155Key( + eip155, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// GetRollapp returns a rollapp from its chain name +func (k Keeper) GetRollapp( + ctx sdk.Context, + rollappId string, +) (val types.Rollapp, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.RollappKeyPrefix)) + + b := store.Get(types.RollappKey( + rollappId, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveRollapp removes a rollapp from the store using rollapp name +func (k Keeper) RemoveRollapp( + ctx sdk.Context, + rollappId string, +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.RollappKeyPrefix)) + store.Delete(types.RollappKey( + rollappId, + )) +} + +// GetAllRollapp returns all rollapp +func (k Keeper) GetAllRollapps(ctx sdk.Context) (list []types.Rollapp) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.RollappKeyPrefix)) + iterator := store.Iterator(nil, nil) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.Rollapp + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} + +// IsRollappStarted returns true if the rollapp is started +func (k Keeper) IsRollappStarted(ctx sdk.Context, rollappId string) bool { + _, found := k.GetLatestStateInfoIndex(ctx, rollappId) + return found +} diff --git a/x/rollapp/keeper/state_info.go b/x/rollapp/keeper/state_info.go new file mode 100644 index 00000000..105cc5b3 --- /dev/null +++ b/x/rollapp/keeper/state_info.go @@ -0,0 +1,78 @@ +package keeper + +import ( + "fmt" + + "github.com/eve-network/eve/x/rollapp/types" + + "cosmossdk.io/store/prefix" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// SetStateInfo set a specific stateInfo in the store from its index +func (k Keeper) SetStateInfo(ctx sdk.Context, stateInfo types.StateInfo) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StateInfoKeyPrefix)) + b := k.cdc.MustMarshal(&stateInfo) + store.Set(types.StateInfoKey( + stateInfo.StateInfoIndex, + ), b) +} + +// GetStateInfo returns a stateInfo from its index +func (k Keeper) GetStateInfo( + ctx sdk.Context, + rollappId string, + index uint64, +) (val types.StateInfo, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StateInfoKeyPrefix)) + + b := store.Get(types.StateInfoKey( + types.StateInfoIndex{RollappId: rollappId, Index: index}, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +func (k Keeper) MustGetStateInfo(ctx sdk.Context, + rollappId string, + index uint64, +) (val types.StateInfo) { + val, found := k.GetStateInfo(ctx, rollappId, index) + if !found { + panic(fmt.Sprintf("stateInfo not found for rollappId: %s, index: %d", rollappId, index)) + } + return +} + +// RemoveStateInfo removes a stateInfo from the store +func (k Keeper) RemoveStateInfo( + ctx sdk.Context, + rollappId string, + index uint64, +) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StateInfoKeyPrefix)) + store.Delete(types.StateInfoKey( + types.StateInfoIndex{RollappId: rollappId, Index: index}, + )) +} + +// GetAllStateInfo returns all stateInfo +func (k Keeper) GetAllStateInfo(ctx sdk.Context) (list []types.StateInfo) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.StateInfoKeyPrefix)) + iterator := store.Iterator(nil, nil) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.StateInfo + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/rollapp/module.go b/x/rollapp/module.go new file mode 100644 index 00000000..becedf0e --- /dev/null +++ b/x/rollapp/module.go @@ -0,0 +1,156 @@ +package rollapp + +import ( + "context" + "encoding/json" + "fmt" + + "cosmossdk.io/core/appmodule" + + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/eve-network/eve/x/rollapp/client/cli" + "github.com/eve-network/eve/x/rollapp/keeper" + "github.com/eve-network/eve/x/rollapp/types" +) + +var ( + _ module.AppModuleBasic = AppModuleBasic{} + _ module.HasGenesisBasics = AppModuleBasic{} + + _ appmodule.AppModule = AppModule{} + _ appmodule.HasEndBlocker = AppModule{} + _ module.HasConsensusVersion = AppModule{} + _ module.HasGenesis = AppModule{} + _ module.HasServices = AppModule{} +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface that defines the independent methodsa Cosmos SDK module +// needs to implement. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the name of the module as a string +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs +// to/from []byte in order to persist them in the module's KVStore +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(cdc) +} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient( + context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users +// to generate new transactions containing messages defined in the module +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by +// end-users to generate new queries to the subset of the state defined by the module +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd(types.StoreKey) +} + +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default +// GenesisState need to be defined by the module developer and is primarily used for testing +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + // TODO(CORE-380): Add dependent keepers (prices, fee-tiers) +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + } +} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + +// IsOnePerModuleType is a marker function just indicates that this is a one-per-module type. +func (am AppModule) IsOnePerModuleType() {} + +// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +// InitGenesis performs the module's genesis initialization. It returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + InitGenesis(ctx, am.keeper, genState) +} + +// ExportGenesis returns the module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each +// consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should +// be set to 1 +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// EndBlock contains the logic that is automatically triggered at the end of each block +func (am AppModule) EndBlock(ctx context.Context) error { + return nil +} diff --git a/x/rollapp/types/bank.pb.go b/x/rollapp/types/bank.pb.go new file mode 100644 index 00000000..4ae58083 --- /dev/null +++ b/x/rollapp/types/bank.pb.go @@ -0,0 +1,987 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollapp/bank.proto + +package types + +import ( + fmt "fmt" + _ "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 + +// DenomUnit represents a struct that describes a given +// denomination unit of the basic token. +type DenomUnit struct { + // denom represents the string name of the given denom unit (e.g uatom). + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + // exponent represents power of 10 exponent that one must + // raise the base_denom to in order to equal the given DenomUnit's denom + // 1 denom = 10^exponent base_denom + // (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with + // exponent = 6, thus: 1 atom = 10^6 uatom). + Exponent uint32 `protobuf:"varint,2,opt,name=exponent,proto3" json:"exponent,omitempty"` + // aliases is a list of string aliases for the given denom + Aliases []string `protobuf:"bytes,3,rep,name=aliases,proto3" json:"aliases,omitempty"` +} + +func (m *DenomUnit) Reset() { *m = DenomUnit{} } +func (m *DenomUnit) String() string { return proto.CompactTextString(m) } +func (*DenomUnit) ProtoMessage() {} +func (*DenomUnit) Descriptor() ([]byte, []int) { + return fileDescriptor_4c717c0caac1e65d, []int{0} +} +func (m *DenomUnit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DenomUnit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DenomUnit.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 *DenomUnit) XXX_Merge(src proto.Message) { + xxx_messageInfo_DenomUnit.Merge(m, src) +} +func (m *DenomUnit) XXX_Size() int { + return m.Size() +} +func (m *DenomUnit) XXX_DiscardUnknown() { + xxx_messageInfo_DenomUnit.DiscardUnknown(m) +} + +var xxx_messageInfo_DenomUnit proto.InternalMessageInfo + +func (m *DenomUnit) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *DenomUnit) GetExponent() uint32 { + if m != nil { + return m.Exponent + } + return 0 +} + +func (m *DenomUnit) GetAliases() []string { + if m != nil { + return m.Aliases + } + return nil +} + +// Metadata represents a struct that describes +// a basic token. +type TokenMetadata struct { + Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` + // denom_units represents the list of DenomUnit's for a given coin + DenomUnits []*DenomUnit `protobuf:"bytes,2,rep,name=denom_units,json=denomUnits,proto3" json:"denom_units,omitempty"` + // base represents the base denom (should be the DenomUnit with exponent = 0). + Base string `protobuf:"bytes,3,opt,name=base,proto3" json:"base,omitempty"` + // display indicates the suggested denom that should be + // displayed in clients. + Display string `protobuf:"bytes,4,opt,name=display,proto3" json:"display,omitempty"` + // name defines the name of the token (eg: Cosmos Atom) + // + // Since: cosmos-sdk 0.43 + Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` + // symbol is the token symbol usually shown on exchanges (eg: ATOM). This can + // be the same as the display. + // + // Since: cosmos-sdk 0.43 + Symbol string `protobuf:"bytes,6,opt,name=symbol,proto3" json:"symbol,omitempty"` + // URI to a document (on or off-chain) that contains additional information. + // Optional. + // + // Since: cosmos-sdk 0.46 + URI string `protobuf:"bytes,7,opt,name=uri,proto3" json:"uri,omitempty"` + // URIHash is a sha256 hash of a document pointed by URI. It's used to verify + // that the document didn't change. Optional. + // + // Since: cosmos-sdk 0.46 + URIHash string `protobuf:"bytes,8,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` +} + +func (m *TokenMetadata) Reset() { *m = TokenMetadata{} } +func (m *TokenMetadata) String() string { return proto.CompactTextString(m) } +func (*TokenMetadata) ProtoMessage() {} +func (*TokenMetadata) Descriptor() ([]byte, []int) { + return fileDescriptor_4c717c0caac1e65d, []int{1} +} +func (m *TokenMetadata) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TokenMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TokenMetadata.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 *TokenMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_TokenMetadata.Merge(m, src) +} +func (m *TokenMetadata) XXX_Size() int { + return m.Size() +} +func (m *TokenMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_TokenMetadata.DiscardUnknown(m) +} + +var xxx_messageInfo_TokenMetadata proto.InternalMessageInfo + +func (m *TokenMetadata) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *TokenMetadata) GetDenomUnits() []*DenomUnit { + if m != nil { + return m.DenomUnits + } + return nil +} + +func (m *TokenMetadata) GetBase() string { + if m != nil { + return m.Base + } + return "" +} + +func (m *TokenMetadata) GetDisplay() string { + if m != nil { + return m.Display + } + return "" +} + +func (m *TokenMetadata) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *TokenMetadata) GetSymbol() string { + if m != nil { + return m.Symbol + } + return "" +} + +func (m *TokenMetadata) GetURI() string { + if m != nil { + return m.URI + } + return "" +} + +func (m *TokenMetadata) GetURIHash() string { + if m != nil { + return m.URIHash + } + return "" +} + +func init() { + proto.RegisterType((*DenomUnit)(nil), "nucleic.rollapp.DenomUnit") + proto.RegisterType((*TokenMetadata)(nil), "nucleic.rollapp.TokenMetadata") +} + +func init() { proto.RegisterFile("nucleic/rollapp/bank.proto", fileDescriptor_4c717c0caac1e65d) } + +var fileDescriptor_4c717c0caac1e65d = []byte{ + // 369 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0xb1, 0x6a, 0xeb, 0x30, + 0x18, 0x85, 0xe3, 0x38, 0x89, 0x13, 0x85, 0x70, 0x41, 0x84, 0x8b, 0xae, 0x07, 0xc7, 0x64, 0xb8, + 0x78, 0xb9, 0x36, 0xe4, 0x8e, 0xdd, 0x42, 0x87, 0x06, 0xda, 0x45, 0x34, 0x14, 0xba, 0x04, 0xd9, + 0x16, 0xb1, 0x88, 0x2d, 0x19, 0x4b, 0xa6, 0xc9, 0x33, 0x74, 0xe9, 0x63, 0x75, 0xcc, 0xd8, 0x29, + 0x14, 0xe7, 0x45, 0x8a, 0x1c, 0x3b, 0x94, 0x6e, 0xe7, 0x3b, 0xe7, 0x20, 0xfd, 0x3f, 0x3f, 0xb0, + 0x79, 0x19, 0xa5, 0x94, 0x45, 0x41, 0x21, 0xd2, 0x94, 0xe4, 0x79, 0x10, 0x12, 0xbe, 0xf3, 0xf3, + 0x42, 0x28, 0x01, 0x7f, 0x35, 0x99, 0xdf, 0x64, 0xf6, 0x74, 0x2b, 0xb6, 0xa2, 0xce, 0x02, 0xad, + 0x2e, 0xb5, 0xf9, 0x13, 0x18, 0xdd, 0x52, 0x2e, 0xb2, 0x35, 0x67, 0x0a, 0x4e, 0x41, 0x3f, 0xd6, + 0x80, 0x0c, 0xd7, 0xf0, 0x46, 0xf8, 0x02, 0xd0, 0x06, 0x43, 0xba, 0xcf, 0x05, 0xa7, 0x5c, 0xa1, + 0xae, 0x6b, 0x78, 0x13, 0x7c, 0x65, 0x88, 0x80, 0x45, 0x52, 0x46, 0x24, 0x95, 0xc8, 0x74, 0x4d, + 0x6f, 0x84, 0x5b, 0x9c, 0xbf, 0x76, 0xc1, 0xe4, 0x51, 0xec, 0x28, 0x7f, 0xa0, 0x8a, 0xc4, 0x44, + 0x11, 0xe8, 0x82, 0x71, 0x4c, 0x65, 0x54, 0xb0, 0x5c, 0x31, 0xc1, 0x9b, 0x3f, 0xbe, 0x5b, 0xf0, + 0x46, 0x37, 0xb8, 0xc8, 0x36, 0x25, 0x67, 0x4a, 0xa2, 0xae, 0x6b, 0x7a, 0xe3, 0x85, 0xed, 0xff, + 0xd8, 0xc4, 0xbf, 0x0e, 0x8c, 0x41, 0xdc, 0x4a, 0x09, 0x21, 0xe8, 0x85, 0x44, 0x52, 0x64, 0xd6, + 0xef, 0xd6, 0x5a, 0x8f, 0x17, 0x33, 0x99, 0xa7, 0xe4, 0x80, 0x7a, 0xb5, 0xdd, 0xa2, 0x6e, 0x73, + 0x92, 0x51, 0xd4, 0xbf, 0xb4, 0xb5, 0x86, 0xbf, 0xc1, 0x40, 0x1e, 0xb2, 0x50, 0xa4, 0x68, 0x50, + 0xbb, 0x0d, 0xc1, 0x3f, 0xc0, 0x2c, 0x0b, 0x86, 0x2c, 0x6d, 0x2e, 0xad, 0xea, 0x34, 0x33, 0xd7, + 0x78, 0x85, 0xb5, 0x07, 0xff, 0x82, 0x61, 0x59, 0xb0, 0x4d, 0x42, 0x64, 0x82, 0x86, 0x75, 0x3e, + 0xae, 0x4e, 0x33, 0x6b, 0x8d, 0x57, 0x77, 0x44, 0x26, 0xd8, 0x2a, 0x0b, 0xa6, 0xc5, 0xf2, 0xfe, + 0xbd, 0x72, 0x8c, 0x63, 0xe5, 0x18, 0x9f, 0x95, 0x63, 0xbc, 0x9d, 0x9d, 0xce, 0xf1, 0xec, 0x74, + 0x3e, 0xce, 0x4e, 0xe7, 0x79, 0xb1, 0x65, 0x2a, 0x29, 0x43, 0x3f, 0x12, 0x59, 0xd0, 0x2c, 0xfa, + 0x8f, 0x53, 0xf5, 0x22, 0x8a, 0x5d, 0xcb, 0xc1, 0xfe, 0x7a, 0x60, 0x75, 0xc8, 0xa9, 0x0c, 0x07, + 0xf5, 0xed, 0xfe, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0x46, 0x8f, 0xaf, 0xaf, 0x00, 0x02, 0x00, + 0x00, +} + +func (m *DenomUnit) 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 *DenomUnit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DenomUnit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Aliases) > 0 { + for iNdEx := len(m.Aliases) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Aliases[iNdEx]) + copy(dAtA[i:], m.Aliases[iNdEx]) + i = encodeVarintBank(dAtA, i, uint64(len(m.Aliases[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if m.Exponent != 0 { + i = encodeVarintBank(dAtA, i, uint64(m.Exponent)) + i-- + dAtA[i] = 0x10 + } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintBank(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TokenMetadata) 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 *TokenMetadata) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TokenMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.URIHash) > 0 { + i -= len(m.URIHash) + copy(dAtA[i:], m.URIHash) + i = encodeVarintBank(dAtA, i, uint64(len(m.URIHash))) + i-- + dAtA[i] = 0x42 + } + if len(m.URI) > 0 { + i -= len(m.URI) + copy(dAtA[i:], m.URI) + i = encodeVarintBank(dAtA, i, uint64(len(m.URI))) + i-- + dAtA[i] = 0x3a + } + if len(m.Symbol) > 0 { + i -= len(m.Symbol) + copy(dAtA[i:], m.Symbol) + i = encodeVarintBank(dAtA, i, uint64(len(m.Symbol))) + i-- + dAtA[i] = 0x32 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintBank(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x2a + } + if len(m.Display) > 0 { + i -= len(m.Display) + copy(dAtA[i:], m.Display) + i = encodeVarintBank(dAtA, i, uint64(len(m.Display))) + i-- + dAtA[i] = 0x22 + } + if len(m.Base) > 0 { + i -= len(m.Base) + copy(dAtA[i:], m.Base) + i = encodeVarintBank(dAtA, i, uint64(len(m.Base))) + i-- + dAtA[i] = 0x1a + } + if len(m.DenomUnits) > 0 { + for iNdEx := len(m.DenomUnits) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DenomUnits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBank(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintBank(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintBank(dAtA []byte, offset int, v uint64) int { + offset -= sovBank(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *DenomUnit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovBank(uint64(l)) + } + if m.Exponent != 0 { + n += 1 + sovBank(uint64(m.Exponent)) + } + if len(m.Aliases) > 0 { + for _, s := range m.Aliases { + l = len(s) + n += 1 + l + sovBank(uint64(l)) + } + } + return n +} + +func (m *TokenMetadata) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Description) + if l > 0 { + n += 1 + l + sovBank(uint64(l)) + } + if len(m.DenomUnits) > 0 { + for _, e := range m.DenomUnits { + l = e.Size() + n += 1 + l + sovBank(uint64(l)) + } + } + l = len(m.Base) + if l > 0 { + n += 1 + l + sovBank(uint64(l)) + } + l = len(m.Display) + if l > 0 { + n += 1 + l + sovBank(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovBank(uint64(l)) + } + l = len(m.Symbol) + if l > 0 { + n += 1 + l + sovBank(uint64(l)) + } + l = len(m.URI) + if l > 0 { + n += 1 + l + sovBank(uint64(l)) + } + l = len(m.URIHash) + if l > 0 { + n += 1 + l + sovBank(uint64(l)) + } + return n +} + +func sovBank(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozBank(x uint64) (n int) { + return sovBank(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *DenomUnit) 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 ErrIntOverflowBank + } + 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: DenomUnit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DenomUnit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + 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 ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Exponent", wireType) + } + m.Exponent = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Exponent |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Aliases", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + 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 ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Aliases = append(m.Aliases, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBank(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBank + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TokenMetadata) 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 ErrIntOverflowBank + } + 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: TokenMetadata: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TokenMetadata: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + 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 ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomUnits", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBank + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DenomUnits = append(m.DenomUnits, &DenomUnit{}) + if err := m.DenomUnits[len(m.DenomUnits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Base", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + 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 ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Base = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Display", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + 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 ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Display = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + 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 ErrIntOverflowBank + } + 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 ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + 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 ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Symbol = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field URI", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + 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 ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.URI = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field URIHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + 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 ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.URIHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBank(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBank + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipBank(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, ErrIntOverflowBank + } + 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, ErrIntOverflowBank + } + 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, ErrIntOverflowBank + } + 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, ErrInvalidLengthBank + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupBank + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthBank + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthBank = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowBank = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupBank = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/rollapp/types/block_descriptor.pb.go b/x/rollapp/types/block_descriptor.pb.go new file mode 100644 index 00000000..55a5f6a0 --- /dev/null +++ b/x/rollapp/types/block_descriptor.pb.go @@ -0,0 +1,546 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollapp/block_descriptor.proto + +package types + +import ( + fmt "fmt" + _ "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 + +// BlockDescriptor defines a single rollapp chain block description. +type BlockDescriptor struct { + // height is the height of the block + Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + // state_root is a 32 byte array of the hash of the block (state root of the + // block) + StateRoot []byte `protobuf:"bytes,2,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty"` +} + +func (m *BlockDescriptor) Reset() { *m = BlockDescriptor{} } +func (m *BlockDescriptor) String() string { return proto.CompactTextString(m) } +func (*BlockDescriptor) ProtoMessage() {} +func (*BlockDescriptor) Descriptor() ([]byte, []int) { + return fileDescriptor_fccbdab1f9ac4db2, []int{0} +} +func (m *BlockDescriptor) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BlockDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BlockDescriptor.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 *BlockDescriptor) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockDescriptor.Merge(m, src) +} +func (m *BlockDescriptor) XXX_Size() int { + return m.Size() +} +func (m *BlockDescriptor) XXX_DiscardUnknown() { + xxx_messageInfo_BlockDescriptor.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockDescriptor proto.InternalMessageInfo + +func (m *BlockDescriptor) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *BlockDescriptor) GetStateRoot() []byte { + if m != nil { + return m.StateRoot + } + return nil +} + +// BlockDescriptors defines list of BlockDescriptor. +type BlockDescriptors struct { + BlockDescs []BlockDescriptor `protobuf:"bytes,1,rep,name=block_descs,json=blockDescs,proto3" json:"block_descs"` +} + +func (m *BlockDescriptors) Reset() { *m = BlockDescriptors{} } +func (m *BlockDescriptors) String() string { return proto.CompactTextString(m) } +func (*BlockDescriptors) ProtoMessage() {} +func (*BlockDescriptors) Descriptor() ([]byte, []int) { + return fileDescriptor_fccbdab1f9ac4db2, []int{1} +} +func (m *BlockDescriptors) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BlockDescriptors) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BlockDescriptors.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 *BlockDescriptors) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockDescriptors.Merge(m, src) +} +func (m *BlockDescriptors) XXX_Size() int { + return m.Size() +} +func (m *BlockDescriptors) XXX_DiscardUnknown() { + xxx_messageInfo_BlockDescriptors.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockDescriptors proto.InternalMessageInfo + +func (m *BlockDescriptors) GetBlockDescs() []BlockDescriptor { + if m != nil { + return m.BlockDescs + } + return nil +} + +func init() { + proto.RegisterType((*BlockDescriptor)(nil), "nucleic.rollapp.BlockDescriptor") + proto.RegisterType((*BlockDescriptors)(nil), "nucleic.rollapp.BlockDescriptors") +} + +func init() { + proto.RegisterFile("nucleic/rollapp/block_descriptor.proto", fileDescriptor_fccbdab1f9ac4db2) +} + +var fileDescriptor_fccbdab1f9ac4db2 = []byte{ + // 249 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcb, 0x2b, 0x4d, 0xce, + 0x49, 0xcd, 0x4c, 0xd6, 0x2f, 0xca, 0xcf, 0xc9, 0x49, 0x2c, 0x28, 0xd0, 0x4f, 0xca, 0xc9, 0x4f, + 0xce, 0x8e, 0x4f, 0x49, 0x2d, 0x4e, 0x2e, 0xca, 0x2c, 0x28, 0xc9, 0x2f, 0xd2, 0x2b, 0x28, 0xca, + 0x2f, 0xc9, 0x17, 0xe2, 0x87, 0xaa, 0xd3, 0x83, 0xaa, 0x93, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, + 0xcb, 0xe9, 0x83, 0x58, 0x10, 0x65, 0x4a, 0x1e, 0x5c, 0xfc, 0x4e, 0x20, 0x03, 0x5c, 0xe0, 0xfa, + 0x85, 0xc4, 0xb8, 0xd8, 0x32, 0x52, 0x33, 0xd3, 0x33, 0x4a, 0x24, 0x18, 0x15, 0x18, 0x35, 0x58, + 0x82, 0xa0, 0x3c, 0x21, 0x59, 0x2e, 0xae, 0xe2, 0x92, 0xc4, 0x92, 0xd4, 0xf8, 0xa2, 0xfc, 0xfc, + 0x12, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x9e, 0x20, 0x4e, 0xb0, 0x48, 0x50, 0x7e, 0x7e, 0x89, 0x52, + 0x34, 0x97, 0x00, 0x9a, 0x49, 0xc5, 0x42, 0xee, 0x5c, 0xdc, 0x08, 0xe7, 0x15, 0x4b, 0x30, 0x2a, + 0x30, 0x6b, 0x70, 0x1b, 0x29, 0xe8, 0xa1, 0x39, 0x4d, 0x0f, 0x4d, 0x9f, 0x13, 0xcb, 0x89, 0x7b, + 0xf2, 0x0c, 0x41, 0x5c, 0x49, 0x30, 0xe1, 0x62, 0x27, 0x9f, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, + 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, + 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4a, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, + 0x87, 0x9a, 0xab, 0x9b, 0x97, 0x5a, 0x52, 0x9e, 0x5f, 0x94, 0x0d, 0xe3, 0xeb, 0x57, 0xc0, 0x03, + 0xab, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0xec, 0x77, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x80, 0x4d, 0x06, 0x6e, 0x4c, 0x01, 0x00, 0x00, +} + +func (m *BlockDescriptor) 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 *BlockDescriptor) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockDescriptor) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.StateRoot) > 0 { + i -= len(m.StateRoot) + copy(dAtA[i:], m.StateRoot) + i = encodeVarintBlockDescriptor(dAtA, i, uint64(len(m.StateRoot))) + i-- + dAtA[i] = 0x12 + } + if m.Height != 0 { + i = encodeVarintBlockDescriptor(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *BlockDescriptors) 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 *BlockDescriptors) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockDescriptors) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BlockDescs) > 0 { + for iNdEx := len(m.BlockDescs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BlockDescs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBlockDescriptor(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintBlockDescriptor(dAtA []byte, offset int, v uint64) int { + offset -= sovBlockDescriptor(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *BlockDescriptor) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovBlockDescriptor(uint64(m.Height)) + } + l = len(m.StateRoot) + if l > 0 { + n += 1 + l + sovBlockDescriptor(uint64(l)) + } + return n +} + +func (m *BlockDescriptors) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.BlockDescs) > 0 { + for _, e := range m.BlockDescs { + l = e.Size() + n += 1 + l + sovBlockDescriptor(uint64(l)) + } + } + return n +} + +func sovBlockDescriptor(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozBlockDescriptor(x uint64) (n int) { + return sovBlockDescriptor(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *BlockDescriptor) 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 ErrIntOverflowBlockDescriptor + } + 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: BlockDescriptor: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlockDescriptor: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockDescriptor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateRoot", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockDescriptor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthBlockDescriptor + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthBlockDescriptor + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StateRoot = append(m.StateRoot[:0], dAtA[iNdEx:postIndex]...) + if m.StateRoot == nil { + m.StateRoot = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBlockDescriptor(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBlockDescriptor + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BlockDescriptors) 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 ErrIntOverflowBlockDescriptor + } + 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: BlockDescriptors: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlockDescriptors: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockDescs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockDescriptor + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBlockDescriptor + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBlockDescriptor + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockDescs = append(m.BlockDescs, BlockDescriptor{}) + if err := m.BlockDescs[len(m.BlockDescs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBlockDescriptor(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBlockDescriptor + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipBlockDescriptor(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, ErrIntOverflowBlockDescriptor + } + 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, ErrIntOverflowBlockDescriptor + } + 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, ErrIntOverflowBlockDescriptor + } + 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, ErrInvalidLengthBlockDescriptor + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupBlockDescriptor + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthBlockDescriptor + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthBlockDescriptor = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowBlockDescriptor = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupBlockDescriptor = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/rollapp/types/chain_id.go b/x/rollapp/types/chain_id.go new file mode 100644 index 00000000..803f71c7 --- /dev/null +++ b/x/rollapp/types/chain_id.go @@ -0,0 +1,121 @@ +package types + +import ( + "fmt" + "math/big" + "regexp" + "strconv" + "strings" + + errorsmod "cosmossdk.io/errors" +) + +var ( + regexChainID = `[a-z]{1,}` + regexEIP155Separator = `_{1}` + regexEIP155 = `[1-9][0-9]*` + regexEpochSeparator = `-{1}` + regexEpoch = `[1-9][0-9]*` + ethermintChainID = regexp.MustCompile(fmt.Sprintf(`^(%s)%s(%s)%s(%s)$`, + regexChainID, + regexEIP155Separator, + regexEIP155, + regexEpochSeparator, + regexEpoch)) +) + +type ChainID struct { + chainID string + name string + eip155ID *big.Int + revision uint64 +} + +func NewChainID(id string) (ChainID, error) { + chainID := strings.TrimSpace(id) + + if chainID == "" { + return ChainID{}, errorsmod.Wrapf(ErrInvalidRollappID, "empty") + } + + if len(chainID) > 48 { + return ChainID{}, errorsmod.Wrapf(ErrInvalidRollappID, "exceeds 48 chars: %s: len: %d", chainID, len(chainID)) + } + + eip155, err := getEIP155ID(chainID) + if err != nil { + return ChainID{}, err + } + revision, err := getRevisionNumber(chainID) + if err != nil { + return ChainID{}, err + } + matches := strings.Split(chainID, "-") + + if matches[0] == "" { + return ChainID{}, errorsmod.Wrapf(ErrInvalidRollappID, "empty chain id before '-'") + } + + return ChainID{ + chainID: chainID, + eip155ID: eip155, + revision: revision, + name: matches[0], + }, nil +} + +// getEIP155ID parses a string chain identifier's epoch to an Ethereum-compatible +// chain-id in *big.Int format. The function returns an error if the chain-id has an invalid format +func getEIP155ID(chainID string) (*big.Int, error) { + matches := ethermintChainID.FindStringSubmatch(chainID) + + if matches == nil || len(matches) != 4 || matches[1] == "" { + return nil, nil + } + // verify that the chain-id entered is a base 10 integer + chainIDInt, ok := new(big.Int).SetString(matches[2], 10) + if !ok { + return nil, errorsmod.Wrapf(ErrInvalidRollappID, "epoch %s must be base-10 integer format", matches[2]) + } + + return chainIDInt, nil +} + +// getEIP155ID parses a string chain identifier and returns the revision number +func getRevisionNumber(chainID string) (uint64, error) { + matches := strings.Split(chainID, "-") + if len(matches) == 1 { + return 0, nil + } + if len(matches) != 2 { + return 0, errorsmod.Wrapf(ErrInvalidRollappID, "unable to parse revision number") + } + revision, err := strconv.ParseUint(matches[1], 0, 64) + if err != nil { + return 0, errorsmod.Wrapf(ErrInvalidRollappID, "unable to parse revision number: error: %v", err) + } + return revision, nil +} + +func (c *ChainID) IsEIP155() bool { + return c.eip155ID != nil +} + +func (c *ChainID) GetChainID() string { + return c.chainID +} + +func (c *ChainID) GetName() string { + return c.name +} + +func (c *ChainID) GetEIP155ID() uint64 { + if c.eip155ID != nil { + return c.eip155ID.Uint64() + } + return 0 +} + +func (c *ChainID) GetRevisionNumber() uint64 { + return c.revision +} diff --git a/x/rollapp/types/codec.go b/x/rollapp/types/codec.go new file mode 100644 index 00000000..e7dd5575 --- /dev/null +++ b/x/rollapp/types/codec.go @@ -0,0 +1,24 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +func RegisterCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgCreateRollapp{}, "rollapp/CreateRollapp", nil) + cdc.RegisterConcrete(&MsgUpdateState{}, "rollapp/UpdateState", nil) + cdc.RegisterConcrete(&MsgRollappGenesisEvent{}, "rollapp/RollappGenesisEvent", nil) +} + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), &MsgCreateRollapp{}, &MsgUpdateState{}, &MsgRollappGenesisEvent{}) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + Amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) +) diff --git a/x/rollapp/types/errors.go b/x/rollapp/types/errors.go new file mode 100644 index 00000000..efddab5b --- /dev/null +++ b/x/rollapp/types/errors.go @@ -0,0 +1,51 @@ +package types + +// DONTCOVER + +import ( + errorsmod "cosmossdk.io/errors" +) + +// x/rollapp module sentinel errors +var ( + ErrRollappExists = errorsmod.Register(ModuleName, 1000, "rollapp already exists for this rollapp-id; must use new rollapp-id") + ErrInvalidMaxSequencers = errorsmod.Register(ModuleName, 1001, "invalid max sequencers") + ErrInvalidCreatorAddress = errorsmod.Register(ModuleName, 1002, "invalid creator address") + ErrInvalidPermissionedAddress = errorsmod.Register(ModuleName, 1003, "invalid permissioned address") + ErrPermissionedAddressesDuplicate = errorsmod.Register(ModuleName, 1004, "permissioned-address has duplicates") + ErrInvalidNumBlocks = errorsmod.Register(ModuleName, 1005, "invalid number of blocks") + ErrInvalidBlockSequence = errorsmod.Register(ModuleName, 1006, "invalid block sequence") + ErrUnknownRollappID = errorsmod.Register(ModuleName, 1007, "rollapp does not exist") + ErrVersionMismatch = errorsmod.Register(ModuleName, 1008, "rollapp version mismatch") + ErrWrongBlockHeight = errorsmod.Register(ModuleName, 1009, "start-height does not match rollapps state") + ErrMultiUpdateStateInBlock = errorsmod.Register(ModuleName, 1010, "only one state update can take place per block") + ErrInvalidStateRoot = errorsmod.Register(ModuleName, 1011, "invalid blocks state root") + ErrUnauthorizedRollappCreator = errorsmod.Register(ModuleName, 1013, "rollapp creator not registered in the whitelist") + ErrInvalidClientType = errorsmod.Register(ModuleName, 1014, "client type of the rollapp isn't rollkit") + ErrHeightStateNotFinalized = errorsmod.Register(ModuleName, 1015, "rollapp block on this height was not finalized yet") + ErrInvalidAppHash = errorsmod.Register(ModuleName, 1016, "the app hash is different from the finalized state root") + ErrStateNotExists = errorsmod.Register(ModuleName, 1017, "state of this height doesn't exist") + ErrInvalidHeight = errorsmod.Register(ModuleName, 1018, "invalid rollapp height") + ErrRollappCreatorExceedMaximumRollapps = errorsmod.Register(ModuleName, 1019, "rollapp creator exceeds maximum allowed rollapps as registered in the whitelist") + ErrInvalidRollappID = errorsmod.Register(ModuleName, 1020, "invalid rollapp-id") + ErrEIP155Exists = errorsmod.Register(ModuleName, 1021, "EIP155 already exists; must use unique EIP155 identifier") + ErrRollappsDisabled = errorsmod.Register(ModuleName, 1022, "rollapps are disabled") + ErrInvalidTokenMetadata = errorsmod.Register(ModuleName, 1023, "invalid token metadata") + ErrNoFinalizedStateYetForRollapp = errorsmod.Register(ModuleName, 1024, "no finalized state yet for rollapp") + ErrInvalidClientState = errorsmod.Register(ModuleName, 1025, "invalid client state") + ErrInvalidSequencer = errorsmod.Register(ModuleName, 1026, "invalid sequencer") + ErrInvalidGenesisChannelId = errorsmod.Register(ModuleName, 1027, "invalid genesis channel id") + ErrGenesisEventNotTriggered = errorsmod.Register(ModuleName, 1028, "genesis event not triggered yet") + ErrGenesisEventAlreadyTriggered = errorsmod.Register(ModuleName, 1029, "genesis event already triggered") + ErrTooManyPermissionedAddresses = errorsmod.Register(ModuleName, 1030, "invalid number of permissioned addresses") + ErrInvalidGenesisAccount = errorsmod.Register(ModuleName, 1031, "invalid genesis account") + ErrMintTokensFailed = errorsmod.Register(ModuleName, 1032, "failed to mint tokens") + ErrRegisterDenomMetadataFailed = errorsmod.Register(ModuleName, 1033, "failed to register denom metadata") + ErrMismatchedChannelID = errorsmod.Register(ModuleName, 1034, "mismatched channel id") + ErrRollappNotRegistered = errorsmod.Register(ModuleName, 1035, "rollapp not registered") + ErrUnknownRequest = errorsmod.Register(ModuleName, 1036, "unknown request") + ErrNotFound = errorsmod.Register(ModuleName, 1037, "not found") + ErrLogic = errorsmod.Register(ModuleName, 1038, "internal logic error") + ErrUnauthorized = errorsmod.Register(ModuleName, 1039, "unauthorized") + ErrInvalidAddress = errorsmod.Register(ModuleName, 1040, "invalid address") +) diff --git a/x/rollapp/types/events.go b/x/rollapp/types/events.go new file mode 100644 index 00000000..303f4cc3 --- /dev/null +++ b/x/rollapp/types/events.go @@ -0,0 +1,13 @@ +package types + +const ( + EventTypeStateUpdate = "state_update" + EventTypeStatusChange = "status_change" + + AttributeKeyRollappId = "rollapp_id" + AttributeKeyStateInfoIndex = "state_info_index" + AttributeKeyStartHeight = "start_height" + AttributeKeyNumBlocks = "num_blocks" + AttributeKeyDAPath = "da_path" + AttributeKeyStatus = "status" +) diff --git a/x/rollapp/types/expected_keepers.go b/x/rollapp/types/expected_keepers.go new file mode 100644 index 00000000..9f428c7a --- /dev/null +++ b/x/rollapp/types/expected_keepers.go @@ -0,0 +1,44 @@ +package types + +import ( + context "context" + + cmbytes "github.com/cometbft/cometbft/libs/bytes" + transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + "github.com/cosmos/ibc-go/v8/modules/core/exported" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" +) + +// AccountKeeper defines the expected account keeper used for simulations (noalias) +type AccountKeeper interface { + GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI + // Methods imported from account should be defined here +} + +// BankKeeper defines the expected interface needed to retrieve account balances. +type BankKeeper interface { + SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins + MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error +} + +type IBCClientKeeper interface { + GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool) + SetClientState(ctx sdk.Context, clientID string, clientState exported.ClientState) +} + +type TransferKeeper interface { + HasDenomTrace(ctx sdk.Context, denomTraceHash cmbytes.HexBytes) bool + SetDenomTrace(ctx sdk.Context, denomTrace transfertypes.DenomTrace) +} + +type ChannelKeeper interface { + GetChannelClientState(ctx sdk.Context, portID, channelID string) (string, exported.ClientState, error) +} + +type DenomMetadataKeeper interface { + CreateDenomMetadata(ctx sdk.Context, metadata banktypes.Metadata) error +} diff --git a/x/rollapp/types/genesis.go b/x/rollapp/types/genesis.go new file mode 100644 index 00000000..fc92a78f --- /dev/null +++ b/x/rollapp/types/genesis.go @@ -0,0 +1,79 @@ +package types + +import ( + "errors" +) + +// DefaultIndex is the default capability global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default Capability genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + RollappList: []Rollapp{}, + StateInfoList: []StateInfo{}, + LatestStateInfoIndexList: []StateInfoIndex{}, + LatestFinalizedStateIndexList: []StateInfoIndex{}, + BlockHeightToFinalizationQueueList: []BlockHeightToFinalizationQueue{}, + // this line is used by starport scaffolding # genesis/types/default + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + // Check for duplicated index in rollapp + rollappIndexMap := make(map[string]struct{}) + + for _, elem := range gs.RollappList { + index := string(RollappKey(elem.RollappId)) + if _, ok := rollappIndexMap[index]; ok { + return errors.New("duplicated index for rollapp") + } + rollappIndexMap[index] = struct{}{} + } + // Check for duplicated index in stateInfo + stateInfoIndexMap := make(map[string]struct{}) + + for _, elem := range gs.StateInfoList { + index := string(StateInfoKey(elem.StateInfoIndex)) + if _, ok := stateInfoIndexMap[index]; ok { + return errors.New("duplicated index for stateInfo") + } + stateInfoIndexMap[index] = struct{}{} + } + // Check for duplicated index in latestStateInfoIndex + latestStateInfoIndexIndexMap := make(map[string]struct{}) + + for _, elem := range gs.LatestStateInfoIndexList { + index := string(LatestStateInfoIndexKey(elem.RollappId)) + if _, ok := latestStateInfoIndexIndexMap[index]; ok { + return errors.New("duplicated index for latestStateInfoIndex") + } + latestStateInfoIndexIndexMap[index] = struct{}{} + } + // Check for duplicated index in latestFinalizedStateIndex + latestFinalizedStateIndexIndexMap := make(map[string]struct{}) + + for _, elem := range gs.LatestFinalizedStateIndexList { + index := string(LatestFinalizedStateIndexKey(elem.RollappId)) + if _, ok := latestFinalizedStateIndexIndexMap[index]; ok { + return errors.New("duplicated index for latestFinalizedStateIndex") + } + latestFinalizedStateIndexIndexMap[index] = struct{}{} + } + // Check for duplicated index in blockHeightToFinalizationQueue + blockHeightToFinalizationQueueIndexMap := make(map[string]struct{}) + + for _, elem := range gs.BlockHeightToFinalizationQueueList { + index := string(BlockHeightToFinalizationQueueKey(elem.CreationHeight)) + if _, ok := blockHeightToFinalizationQueueIndexMap[index]; ok { + return errors.New("duplicated index for blockHeightToFinalizationQueue") + } + blockHeightToFinalizationQueueIndexMap[index] = struct{}{} + } + // this line is used by starport scaffolding # genesis/types/validate + + return gs.Params.Validate() +} diff --git a/x/rollapp/types/genesis.pb.go b/x/rollapp/types/genesis.pb.go new file mode 100644 index 00000000..0783d7b3 --- /dev/null +++ b/x/rollapp/types/genesis.pb.go @@ -0,0 +1,643 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollapp/genesis.proto + +package types + +import ( + fmt "fmt" + _ "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 + +// GenesisState defines the rollapp module's genesis state. +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + RollappList []Rollapp `protobuf:"bytes,2,rep,name=rollapp_list,json=rollappList,proto3" json:"rollapp_list"` + StateInfoList []StateInfo `protobuf:"bytes,3,rep,name=state_info_list,json=stateInfoList,proto3" json:"state_info_list"` + LatestStateInfoIndexList []StateInfoIndex `protobuf:"bytes,4,rep,name=latest_state_info_index_list,json=latestStateInfoIndexList,proto3" json:"latest_state_info_index_list"` + LatestFinalizedStateIndexList []StateInfoIndex `protobuf:"bytes,5,rep,name=latest_finalized_state_index_list,json=latestFinalizedStateIndexList,proto3" json:"latest_finalized_state_index_list"` + BlockHeightToFinalizationQueueList []BlockHeightToFinalizationQueue `protobuf:"bytes,6,rep,name=block_height_to_finalization_queue_list,json=blockHeightToFinalizationQueueList,proto3" json:"block_height_to_finalization_queue_list"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_165a9e3e67ef0cbd, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetRollappList() []Rollapp { + if m != nil { + return m.RollappList + } + return nil +} + +func (m *GenesisState) GetStateInfoList() []StateInfo { + if m != nil { + return m.StateInfoList + } + return nil +} + +func (m *GenesisState) GetLatestStateInfoIndexList() []StateInfoIndex { + if m != nil { + return m.LatestStateInfoIndexList + } + return nil +} + +func (m *GenesisState) GetLatestFinalizedStateIndexList() []StateInfoIndex { + if m != nil { + return m.LatestFinalizedStateIndexList + } + return nil +} + +func (m *GenesisState) GetBlockHeightToFinalizationQueueList() []BlockHeightToFinalizationQueue { + if m != nil { + return m.BlockHeightToFinalizationQueueList + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "nucleic.rollapp.GenesisState") +} + +func init() { proto.RegisterFile("nucleic/rollapp/genesis.proto", fileDescriptor_165a9e3e67ef0cbd) } + +var fileDescriptor_165a9e3e67ef0cbd = []byte{ + // 400 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xb1, 0x6e, 0xda, 0x40, + 0x18, 0xc7, 0xed, 0x42, 0x19, 0x0e, 0x2a, 0x24, 0xab, 0x52, 0x2d, 0x0b, 0x0c, 0x65, 0x29, 0x4b, + 0x6d, 0x89, 0xaa, 0x0f, 0x50, 0x06, 0x0a, 0x12, 0x43, 0x4b, 0x3b, 0x75, 0xb1, 0x6c, 0x73, 0x98, + 0x13, 0xe6, 0xce, 0xf5, 0x9d, 0x15, 0x92, 0x47, 0xc8, 0x94, 0xb7, 0xc9, 0x2b, 0x30, 0x32, 0x66, + 0x8a, 0x22, 0x78, 0x91, 0xc8, 0x77, 0x9f, 0x09, 0xc1, 0x4a, 0xa4, 0x4c, 0x67, 0xdf, 0xff, 0xfb, + 0x7e, 0xbf, 0xff, 0x70, 0xa8, 0x4d, 0xb3, 0x30, 0xc6, 0x24, 0x74, 0x53, 0x16, 0xc7, 0x7e, 0x92, + 0xb8, 0x11, 0xa6, 0x98, 0x13, 0xee, 0x24, 0x29, 0x13, 0xcc, 0x68, 0x42, 0xec, 0x40, 0x6c, 0x7d, + 0x8c, 0x58, 0xc4, 0x64, 0xe6, 0xe6, 0x5f, 0x6a, 0xcc, 0x6a, 0x9d, 0x53, 0x12, 0x3f, 0xf5, 0xd7, + 0x00, 0xb1, 0x4a, 0x0e, 0x38, 0x21, 0xee, 0x9e, 0xc7, 0x5c, 0xf8, 0x02, 0x7b, 0x84, 0x2e, 0x00, + 0xdf, 0xbb, 0xad, 0xa2, 0xc6, 0x4f, 0xd5, 0xeb, 0x4f, 0x9e, 0x19, 0xdf, 0x51, 0x4d, 0x19, 0x4c, + 0xbd, 0xab, 0xf7, 0xeb, 0x83, 0x4f, 0xce, 0x59, 0x4f, 0xe7, 0x97, 0x8c, 0x87, 0xd5, 0xed, 0x7d, + 0x47, 0x9b, 0xc1, 0xb0, 0xf1, 0x03, 0x35, 0x20, 0xf7, 0x62, 0xc2, 0x85, 0xf9, 0xae, 0x5b, 0xe9, + 0xd7, 0x07, 0x66, 0x69, 0x79, 0xa6, 0x4e, 0xd8, 0xae, 0xc3, 0xf5, 0x94, 0x70, 0x61, 0x8c, 0x51, + 0xf3, 0xa9, 0x9e, 0xa2, 0x54, 0x24, 0xc5, 0x2a, 0x51, 0x64, 0xd5, 0x09, 0x5d, 0x30, 0xe0, 0x7c, + 0xe0, 0xc5, 0x85, 0x24, 0x61, 0xd4, 0x8a, 0x7d, 0x81, 0xb9, 0xf0, 0x4e, 0x80, 0x84, 0xce, 0xf1, + 0x46, 0x61, 0xab, 0x12, 0xdb, 0x79, 0x19, 0x3b, 0xc9, 0x67, 0x81, 0x6d, 0x2a, 0xd4, 0xf3, 0x4c, + 0x6a, 0x18, 0xfa, 0x0c, 0x9a, 0x05, 0xa1, 0x7e, 0x4c, 0xae, 0xf0, 0xfc, 0x28, 0x3c, 0xba, 0xde, + 0xbf, 0xc5, 0xd5, 0x56, 0xbc, 0x51, 0x81, 0x83, 0xa1, 0x42, 0x78, 0xad, 0xa3, 0x2f, 0x41, 0xcc, + 0xc2, 0x95, 0xb7, 0xc4, 0x24, 0x5a, 0x0a, 0x4f, 0xb0, 0x42, 0xed, 0x0b, 0xc2, 0xa8, 0xf7, 0x3f, + 0xc3, 0x19, 0x56, 0xde, 0x9a, 0xf4, 0xba, 0x25, 0xef, 0x30, 0xdf, 0x1f, 0xcb, 0xf5, 0xbf, 0x6c, + 0x74, 0xb2, 0xfc, 0x3b, 0xdf, 0x85, 0x1e, 0xbd, 0xe0, 0xd5, 0xa9, 0xbc, 0xcc, 0x70, 0xba, 0xdd, + 0xdb, 0xfa, 0x6e, 0x6f, 0xeb, 0x0f, 0x7b, 0x5b, 0xbf, 0x39, 0xd8, 0xda, 0xee, 0x60, 0x6b, 0x77, + 0x07, 0x5b, 0xfb, 0x37, 0x88, 0x88, 0x58, 0x66, 0x81, 0x13, 0xb2, 0xb5, 0x0b, 0xfa, 0xaf, 0x14, + 0x8b, 0x0b, 0x96, 0xae, 0x8a, 0x7f, 0x77, 0x73, 0x7c, 0x92, 0xe2, 0x32, 0xc1, 0x3c, 0xa8, 0xc9, + 0xe7, 0xf8, 0xed, 0x31, 0x00, 0x00, 0xff, 0xff, 0x68, 0x84, 0x55, 0x48, 0x35, 0x03, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BlockHeightToFinalizationQueueList) > 0 { + for iNdEx := len(m.BlockHeightToFinalizationQueueList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BlockHeightToFinalizationQueueList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if len(m.LatestFinalizedStateIndexList) > 0 { + for iNdEx := len(m.LatestFinalizedStateIndexList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LatestFinalizedStateIndexList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.LatestStateInfoIndexList) > 0 { + for iNdEx := len(m.LatestStateInfoIndexList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LatestStateInfoIndexList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.StateInfoList) > 0 { + for iNdEx := len(m.StateInfoList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.StateInfoList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.RollappList) > 0 { + for iNdEx := len(m.RollappList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RollappList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.RollappList) > 0 { + for _, e := range m.RollappList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.StateInfoList) > 0 { + for _, e := range m.StateInfoList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.LatestStateInfoIndexList) > 0 { + for _, e := range m.LatestStateInfoIndexList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.LatestFinalizedStateIndexList) > 0 { + for _, e := range m.LatestFinalizedStateIndexList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.BlockHeightToFinalizationQueueList) > 0 { + for _, e := range m.BlockHeightToFinalizationQueueList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappList = append(m.RollappList, Rollapp{}) + if err := m.RollappList[len(m.RollappList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateInfoList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StateInfoList = append(m.StateInfoList, StateInfo{}) + if err := m.StateInfoList[len(m.StateInfoList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestStateInfoIndexList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LatestStateInfoIndexList = append(m.LatestStateInfoIndexList, StateInfoIndex{}) + if err := m.LatestStateInfoIndexList[len(m.LatestStateInfoIndexList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestFinalizedStateIndexList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LatestFinalizedStateIndexList = append(m.LatestFinalizedStateIndexList, StateInfoIndex{}) + if err := m.LatestFinalizedStateIndexList[len(m.LatestFinalizedStateIndexList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHeightToFinalizationQueueList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockHeightToFinalizationQueueList = append(m.BlockHeightToFinalizationQueueList, BlockHeightToFinalizationQueue{}) + if err := m.BlockHeightToFinalizationQueueList[len(m.BlockHeightToFinalizationQueueList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/rollapp/types/hooks.go b/x/rollapp/types/hooks.go new file mode 100644 index 00000000..6718cedd --- /dev/null +++ b/x/rollapp/types/hooks.go @@ -0,0 +1,57 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// These can be utilized to communicate between a rollapp keeper and another +// keeper which must take particular actions when rollapp change state. +// The second keeper must implement this interface, which then the +// rollapp keeper can call. + +// RollappHooks event hooks for rollapp object (noalias) +type RollappHooks interface { + BeforeUpdateState(ctx sdk.Context, seqAddr, rollappId string) error // Must be called when a rollapp's state changes + AfterStateFinalized(ctx sdk.Context, rollappID string, stateInfo *StateInfo) error // Must be called when a rollapp's state changes + FraudSubmitted(ctx sdk.Context, rollappID string, height uint64, seqAddr string) error +} + +var _ RollappHooks = MultiRollappHooks{} + +// combine multiple rollapp hooks, all hook functions are run in array sequence +type MultiRollappHooks []RollappHooks + +// Creates hooks for the Rollapp Module. +func NewMultiRollappHooks(hooks ...RollappHooks) MultiRollappHooks { + return hooks +} + +func (h MultiRollappHooks) BeforeUpdateState(ctx sdk.Context, seqAddr, rollappId string) error { + for i := range h { + err := h[i].BeforeUpdateState(ctx, seqAddr, rollappId) + if err != nil { + return err + } + } + return nil +} + +func (h MultiRollappHooks) AfterStateFinalized(ctx sdk.Context, rollappID string, stateInfo *StateInfo) error { + for i := range h { + err := h[i].AfterStateFinalized(ctx, rollappID, stateInfo) + if err != nil { + return err + } + } + return nil +} + +func (h MultiRollappHooks) FraudSubmitted(ctx sdk.Context, rollappID string, height uint64, seqAddr string) error { + for i := range h { + err := h[i].FraudSubmitted(ctx, rollappID, height, seqAddr) + if err != nil { + return err + } + } + return nil +} diff --git a/x/rollapp/types/key_block_height_to_finalization_queue.go b/x/rollapp/types/key_block_height_to_finalization_queue.go new file mode 100644 index 00000000..efc53c77 --- /dev/null +++ b/x/rollapp/types/key_block_height_to_finalization_queue.go @@ -0,0 +1,24 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // BlockHeightToFinalizationQueueKeyPrefix is the prefix to retrieve all BlockHeightToFinalizationQueue + BlockHeightToFinalizationQueueKeyPrefix = "BlockHeightToFinalizationQueue/value/" +) + +// BlockHeightToFinalizationQueueKey returns the store key to retrieve a BlockHeightToFinalizationQueue from the index fields +func BlockHeightToFinalizationQueueKey( + creationHeight uint64, +) []byte { + var key []byte + + creationHeightBytes := make([]byte, 8) + binary.BigEndian.PutUint64(creationHeightBytes, creationHeight) + key = append(key, creationHeightBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/rollapp/types/key_latest_finalized_state_index.go b/x/rollapp/types/key_latest_finalized_state_index.go new file mode 100644 index 00000000..156d6035 --- /dev/null +++ b/x/rollapp/types/key_latest_finalized_state_index.go @@ -0,0 +1,23 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // LatestFinalizedStateIndexKeyPrefix is the prefix to retrieve all LatestFinalizedStateIndex + LatestFinalizedStateIndexKeyPrefix = "LatestFinalizedStateIndex/value/" +) + +// LatestFinalizedStateIndexKey returns the store key to retrieve a LatestFinalizedStateIndex from the index fields +func LatestFinalizedStateIndexKey( + rollappId string, +) []byte { + var key []byte + + rollappIdBytes := []byte(rollappId) + key = append(key, rollappIdBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/rollapp/types/key_latest_state_info_index.go b/x/rollapp/types/key_latest_state_info_index.go new file mode 100644 index 00000000..3c6eb3c3 --- /dev/null +++ b/x/rollapp/types/key_latest_state_info_index.go @@ -0,0 +1,23 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // LatestStateInfoIndexKeyPrefix is the prefix to retrieve all LatestStateInfoIndex + LatestStateInfoIndexKeyPrefix = "LatestStateInfoIndex/value/" +) + +// LatestStateInfoIndexKey returns the store key to retrieve a LatestStateInfoIndex from the index fields +func LatestStateInfoIndexKey( + rollappId string, +) []byte { + var key []byte + + rollappIdBytes := []byte(rollappId) + key = append(key, rollappIdBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/rollapp/types/key_rollapp.go b/x/rollapp/types/key_rollapp.go new file mode 100644 index 00000000..4a93293a --- /dev/null +++ b/x/rollapp/types/key_rollapp.go @@ -0,0 +1,38 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // RollappKeyPrefix is the prefix to retrieve all Rollapp + RollappKeyPrefix = "Rollapp/value/" + RollappByEIP155KeyPrefix = "RollappByEIP155/value/" +) + +// RollappKey returns the store key to retrieve a Rollapp from the index fields +func RollappKey( + rollappId string, +) []byte { + var key []byte + + rollappIdBytes := []byte(rollappId) + key = append(key, rollappIdBytes...) + key = append(key, []byte("/")...) + + return key +} + +// RollappByEIP155Key returns the store key to retrieve a Rollapp from the index fields +func RollappByEIP155Key( + eip155 uint64, +) []byte { + var key []byte + + eip155Bytes := make([]byte, 8) + binary.LittleEndian.PutUint64(eip155Bytes, eip155) + key = append(key, eip155Bytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/rollapp/types/key_state_info.go b/x/rollapp/types/key_state_info.go new file mode 100644 index 00000000..1b92f13a --- /dev/null +++ b/x/rollapp/types/key_state_info.go @@ -0,0 +1,31 @@ +package types + +import ( + "encoding/binary" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ binary.ByteOrder + +const ( + // StateInfoKeyPrefix is the prefix to retrieve all StateInfo + StateInfoKeyPrefix = "StateInfo/value/" +) + +// StateInfoKey returns the store key to retrieve a StateInfo from the index fields +func StateInfoKey( + stateInfoIndex StateInfoIndex, +) []byte { + var key []byte + // build the key bytes + rollappIdBytes := []byte(stateInfoIndex.RollappId) + stateInfoIndexBytes := sdk.Uint64ToBigEndian(stateInfoIndex.Index) + // concatenate the byte slices directly + key = append(key, rollappIdBytes...) + key = append(key, []byte("/")...) + key = append(key, stateInfoIndexBytes...) + key = append(key, []byte("/")...) + + return key +} diff --git a/x/rollapp/types/keys.go b/x/rollapp/types/keys.go new file mode 100644 index 00000000..aadec02e --- /dev/null +++ b/x/rollapp/types/keys.go @@ -0,0 +1,22 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "rollapp" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // RouterKey is the message route for slashing + RouterKey = ModuleName + + // QuerierRoute defines the module's query routing key + QuerierRoute = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_rollapp" +) + +func KeyPrefix(p string) []byte { + return []byte(p) +} diff --git a/x/rollapp/types/msg_create_rollapp.go b/x/rollapp/types/msg_create_rollapp.go new file mode 100644 index 00000000..7d89a8d8 --- /dev/null +++ b/x/rollapp/types/msg_create_rollapp.go @@ -0,0 +1,69 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const TypeMsgCreateRollapp = "create_rollapp" + +var _ sdk.Msg = &MsgCreateRollapp{} + +func NewMsgCreateRollapp(creator string, rollappId string, maxSequencers uint64, permissionedAddresses []string, + metadatas []TokenMetadata, genesisAccounts []GenesisAccount, +) *MsgCreateRollapp { + return &MsgCreateRollapp{ + Creator: creator, + RollappId: rollappId, + MaxSequencers: maxSequencers, + PermissionedAddresses: permissionedAddresses, + Metadatas: metadatas, + GenesisAccounts: genesisAccounts, + } +} + +func (msg *MsgCreateRollapp) Route() string { + return RouterKey +} + +func (msg *MsgCreateRollapp) Type() string { + return TypeMsgCreateRollapp +} + +func (msg *MsgCreateRollapp) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgCreateRollapp) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgCreateRollapp) GetRollapp() Rollapp { + // Build the genesis state from the genesis accounts + rollappGenesisState := RollappGenesisState{ + IsGenesisEvent: false, + } + rollappGenesisState.GenesisAccounts = make([]*GenesisAccount, len(msg.GenesisAccounts)) + for i := range msg.GenesisAccounts { + rollappGenesisState.GenesisAccounts[i] = &msg.GenesisAccounts[i] + } + metadata := make([]*TokenMetadata, len(msg.Metadatas)) + for i := range msg.Metadatas { + metadata[i] = &msg.Metadatas[i] + } + + return NewRollapp(msg.Creator, msg.RollappId, msg.MaxSequencers, msg.PermissionedAddresses, metadata, rollappGenesisState) +} + +func (msg *MsgCreateRollapp) ValidateBasic() error { + rollapp := msg.GetRollapp() + if err := rollapp.ValidateBasic(); err != nil { + return err + } + + return nil +} diff --git a/x/rollapp/types/msg_rollapp_genesis_event.go b/x/rollapp/types/msg_rollapp_genesis_event.go new file mode 100644 index 00000000..da96518d --- /dev/null +++ b/x/rollapp/types/msg_rollapp_genesis_event.go @@ -0,0 +1,62 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const TypeMsgRollappGenesisEvent = "rollapp_genesis_event" + +var _ sdk.Msg = &MsgRollappGenesisEvent{} + +const ( + maxChannelIDLength = 100 + maxRollappIDLength = 100 +) + +func NewMsgRollappGenesisEvent(address string, channel_id string, rollapp_id string) *MsgRollappGenesisEvent { + return &MsgRollappGenesisEvent{ + Address: address, + ChannelId: channel_id, + RollappId: rollapp_id, + } +} + +func (msg *MsgRollappGenesisEvent) Route() string { + return RouterKey +} + +func (msg *MsgRollappGenesisEvent) Type() string { + return TypeMsgRollappGenesisEvent +} + +func (msg *MsgRollappGenesisEvent) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgRollappGenesisEvent) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgRollappGenesisEvent) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + return errorsmod.Wrapf(ErrInvalidAddress, "invalid address (%s)", err) + } + if msg.ChannelId == "" { + return errorsmod.Wrap(ErrInvalidGenesisChannelId, "channel id cannot be empty") + } else if len(msg.ChannelId) > maxChannelIDLength { + return errorsmod.Wrapf(ErrInvalidGenesisChannelId, "channel id cannot exceed %d characters", maxChannelIDLength) + } + if msg.RollappId == "" { + return errorsmod.Wrap(ErrInvalidRollappID, "rollapp id cannot be empty") + } else if len(msg.RollappId) > maxRollappIDLength { + return errorsmod.Wrapf(ErrInvalidRollappID, "rollapp id cannot exceed %d characters", maxRollappIDLength) + } + return nil +} diff --git a/x/rollapp/types/msg_update_state.go b/x/rollapp/types/msg_update_state.go new file mode 100644 index 00000000..79397e61 --- /dev/null +++ b/x/rollapp/types/msg_update_state.go @@ -0,0 +1,79 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const TypeMsgUpdateState = "update_state" + +var _ sdk.Msg = &MsgUpdateState{} + +func NewMsgUpdateState(creator string, rollappId string, startHeight uint64, numBlocks uint64, daPath string, version uint64, blockDescs *BlockDescriptors) *MsgUpdateState { + return &MsgUpdateState{ + Creator: creator, + RollappId: rollappId, + StartHeight: startHeight, + NumBlocks: numBlocks, + DaPath: daPath, + Version: version, + BlockDescs: *blockDescs, + } +} + +func (msg *MsgUpdateState) Route() string { + return RouterKey +} + +func (msg *MsgUpdateState) Type() string { + return TypeMsgUpdateState +} + +func (msg *MsgUpdateState) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgUpdateState) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgUpdateState) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return errorsmod.Wrapf(ErrInvalidAddress, "invalid creator address (%s)", err) + } + + // an update cann't be with no block descriptors + if msg.NumBlocks == uint64(0) { + return errorsmod.Wrap(ErrInvalidNumBlocks, "number of blocks can not be zero") + } + + // check to see that update contains all BDs + if len(msg.BlockDescs.BlockDescs) != int(msg.NumBlocks) { + return errorsmod.Wrapf(ErrInvalidNumBlocks, "number of blocks (%d) != number of block descriptors(%d)", msg.NumBlocks, len(msg.BlockDescs.BlockDescs)) + } + + // check to see that startHeight is not zaro + if msg.StartHeight == 0 { + return errorsmod.Wrapf(ErrWrongBlockHeight, "StartHeight must be greater than zero") + } + + // check that the blocks are sequential by height + for bdIndex := uint64(0); bdIndex < msg.NumBlocks; bdIndex += 1 { + if msg.BlockDescs.BlockDescs[bdIndex].Height != msg.StartHeight+bdIndex { + return ErrInvalidBlockSequence + } + // check to see stateRoot is a 32 byte array + if len(msg.BlockDescs.BlockDescs[bdIndex].StateRoot) != 32 { + return errorsmod.Wrapf(ErrInvalidStateRoot, "StateRoot of block high (%d) must be 32 byte array. But received (%d) bytes", + msg.BlockDescs.BlockDescs[bdIndex].Height, len(msg.BlockDescs.BlockDescs[bdIndex].StateRoot)) + } + } + + return nil +} diff --git a/x/rollapp/types/params.go b/x/rollapp/types/params.go new file mode 100644 index 00000000..9bb71f74 --- /dev/null +++ b/x/rollapp/types/params.go @@ -0,0 +1,115 @@ +package types + +import ( + "errors" + "fmt" + + "gopkg.in/yaml.v2" + + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +var ( + // KeyRollappsEnabled is store's key for RollappsEnabled Params + KeyRollappsEnabled = []byte("RollappsEnabled") + // DeployerWhitelist is store's key for DeployerWhitelist Params + KeyDeployerWhitelist = []byte("DeployerWhitelist") + // KeyDisputePeriodInBlocks is store's key for DisputePeriodInBlocks Params + KeyDisputePeriodInBlocks = []byte("DisputePeriodInBlocks") + // default value + DefaultDisputePeriodInBlocks uint64 = 3 + // MinDisputePeriodInBlocks is the minimum number of blocks for dispute period + MinDisputePeriodInBlocks uint64 = 1 +) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams( + enabled bool, + disputePeriodInBlocks uint64, + deployerWhitelist []DeployerParams, +) Params { + return Params{ + DisputePeriodInBlocks: disputePeriodInBlocks, + DeployerWhitelist: deployerWhitelist, + RollappsEnabled: enabled, + } +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams( + true, DefaultDisputePeriodInBlocks, []DeployerParams{}, + ) +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyDisputePeriodInBlocks, &p.DisputePeriodInBlocks, validateDisputePeriodInBlocks), + paramtypes.NewParamSetPair(KeyDeployerWhitelist, &p.DeployerWhitelist, validateDeployerWhitelist), + paramtypes.NewParamSetPair(KeyRollappsEnabled, &p.RollappsEnabled, func(_ interface{}) error { return nil }), + } +} + +// Validate validates the set of params +func (p Params) Validate() error { + if err := validateDisputePeriodInBlocks(p.DisputePeriodInBlocks); err != nil { + return err + } + + return validateDeployerWhitelist(p.DeployerWhitelist) +} + +// String implements the Stringer interface. +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} + +// validateDisputePeriodInBlocks validates the DisputePeriodInBlocks param +func validateDisputePeriodInBlocks(v interface{}) error { + disputePeriodInBlocks, ok := v.(uint64) + if !ok { + return fmt.Errorf("invalid parameter type: %T", v) + } + + if disputePeriodInBlocks < MinDisputePeriodInBlocks { + return errors.New("dispute period cannot be lower than 1 block") + } + + return nil +} + +// validateDeployerWhitelist validates the DeployerWhitelist param +func validateDeployerWhitelist(v interface{}) error { + deployerWhitelist, ok := v.([]DeployerParams) + if !ok { + return fmt.Errorf("invalid parameter type: %T", v) + } + + // Check for duplicated index in deployer address + rollappDeployerIndexMap := make(map[string]struct{}) + + for i, item := range deployerWhitelist { + // check Bech32 format + if _, err := sdk.AccAddressFromBech32(item.Address); err != nil { + return fmt.Errorf("deployerWhitelist[%d] format error: %s", i, err.Error()) + } + + // check duplicate + if _, ok := rollappDeployerIndexMap[item.Address]; ok { + return errors.New("duplicated deployer address in deployerWhitelist") + } + rollappDeployerIndexMap[item.Address] = struct{}{} + } + + return nil +} diff --git a/x/rollapp/types/params.pb.go b/x/rollapp/types/params.pb.go new file mode 100644 index 00000000..9a82518f --- /dev/null +++ b/x/rollapp/types/params.pb.go @@ -0,0 +1,592 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollapp/params.proto + +package types + +import ( + fmt "fmt" + _ "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 + +type DeployerParams struct { + // address is a bech32-encoded address of the + // accounts that are allowed to create a rollapp. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` +} + +func (m *DeployerParams) Reset() { *m = DeployerParams{} } +func (m *DeployerParams) String() string { return proto.CompactTextString(m) } +func (*DeployerParams) ProtoMessage() {} +func (*DeployerParams) Descriptor() ([]byte, []int) { + return fileDescriptor_cd46fee5d70d5320, []int{0} +} +func (m *DeployerParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DeployerParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DeployerParams.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 *DeployerParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeployerParams.Merge(m, src) +} +func (m *DeployerParams) XXX_Size() int { + return m.Size() +} +func (m *DeployerParams) XXX_DiscardUnknown() { + xxx_messageInfo_DeployerParams.DiscardUnknown(m) +} + +var xxx_messageInfo_DeployerParams proto.InternalMessageInfo + +func (m *DeployerParams) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +// Params defines the parameters for the module. +type Params struct { + // dispute_period_in_blocks the number of blocks it takes + // to change a status of a state from received to finalized. + // during that period, any user could submit fraud proof + DisputePeriodInBlocks uint64 `protobuf:"varint,1,opt,name=dispute_period_in_blocks,json=disputePeriodInBlocks,proto3" json:"dispute_period_in_blocks,omitempty" yaml:"dispute_period_in_blocks"` + // deployer_whitelist is a list of the + // accounts that are allowed to create a rollapp and maximum number of + // rollapps. In the case of an empty list, there are no restrictions + DeployerWhitelist []DeployerParams `protobuf:"bytes,2,rep,name=deployer_whitelist,json=deployerWhitelist,proto3" json:"deployer_whitelist" yaml:"deployer_whitelist"` + RollappsEnabled bool `protobuf:"varint,3,opt,name=rollapps_enabled,json=rollappsEnabled,proto3" json:"rollapps_enabled,omitempty" yaml:"rollapps_enabled"` +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_cd46fee5d70d5320, []int{1} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetDisputePeriodInBlocks() uint64 { + if m != nil { + return m.DisputePeriodInBlocks + } + return 0 +} + +func (m *Params) GetDeployerWhitelist() []DeployerParams { + if m != nil { + return m.DeployerWhitelist + } + return nil +} + +func (m *Params) GetRollappsEnabled() bool { + if m != nil { + return m.RollappsEnabled + } + return false +} + +func init() { + proto.RegisterType((*DeployerParams)(nil), "nucleic.rollapp.DeployerParams") + proto.RegisterType((*Params)(nil), "nucleic.rollapp.Params") +} + +func init() { proto.RegisterFile("nucleic/rollapp/params.proto", fileDescriptor_cd46fee5d70d5320) } + +var fileDescriptor_cd46fee5d70d5320 = []byte{ + // 351 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xc9, 0x2b, 0x4d, 0xce, + 0x49, 0xcd, 0x4c, 0xd6, 0x2f, 0xca, 0xcf, 0xc9, 0x49, 0x2c, 0x28, 0xd0, 0x2f, 0x48, 0x2c, 0x4a, + 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x87, 0xca, 0xea, 0x41, 0x65, 0xa5, + 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x72, 0xfa, 0x20, 0x16, 0x44, 0x99, 0x92, 0x1d, 0x17, 0x9f, + 0x4b, 0x6a, 0x41, 0x4e, 0x7e, 0x65, 0x6a, 0x51, 0x00, 0x58, 0xbb, 0x90, 0x0e, 0x17, 0x7b, 0x62, + 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0xb1, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xa7, 0x93, 0xd0, 0xa7, 0x7b, + 0xf2, 0x7c, 0x95, 0x89, 0xb9, 0x39, 0x56, 0x4a, 0x50, 0x09, 0xa5, 0x20, 0x98, 0x12, 0xa5, 0xe5, + 0x4c, 0x5c, 0x6c, 0x50, 0x8d, 0x31, 0x5c, 0x12, 0x29, 0x99, 0xc5, 0x05, 0xa5, 0x25, 0xa9, 0xf1, + 0x05, 0xa9, 0x45, 0x99, 0xf9, 0x29, 0xf1, 0x99, 0x79, 0xf1, 0x49, 0x39, 0xf9, 0xc9, 0xd9, 0x10, + 0x93, 0x58, 0x9c, 0x94, 0x3f, 0xdd, 0x93, 0x97, 0x87, 0x98, 0x84, 0x4b, 0xa5, 0x52, 0x90, 0x28, + 0x54, 0x2a, 0x00, 0x2c, 0xe3, 0x99, 0xe7, 0x04, 0x16, 0x17, 0x2a, 0xe4, 0x12, 0x4a, 0x81, 0x3a, + 0x34, 0xbe, 0x3c, 0x23, 0xb3, 0x24, 0x35, 0x27, 0xb3, 0xb8, 0x44, 0x82, 0x49, 0x81, 0x59, 0x83, + 0xdb, 0x48, 0x5e, 0x0f, 0xcd, 0xb3, 0x7a, 0xa8, 0x7e, 0x72, 0x52, 0x3c, 0x71, 0x4f, 0x9e, 0xe1, + 0xd3, 0x3d, 0x79, 0x49, 0xa8, 0xe5, 0x18, 0x06, 0x29, 0x05, 0x09, 0xc2, 0x04, 0xc3, 0x61, 0x62, + 0x42, 0x6e, 0x5c, 0x02, 0x50, 0xf3, 0x8a, 0xe3, 0x53, 0xf3, 0x12, 0x93, 0x72, 0x52, 0x53, 0x24, + 0x98, 0x15, 0x18, 0x35, 0x38, 0x9c, 0xa4, 0x3f, 0xdd, 0x93, 0x17, 0x87, 0x98, 0x85, 0xae, 0x42, + 0x29, 0x88, 0x1f, 0x26, 0xe4, 0x0a, 0x11, 0xb1, 0x62, 0x99, 0xb1, 0x40, 0x9e, 0xc1, 0xc9, 0xe7, + 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, + 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x8c, 0xd2, 0x33, 0x4b, 0x32, 0x4a, + 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xa1, 0x1e, 0xd1, 0xcd, 0x4b, 0x2d, 0x29, 0xcf, 0x2f, 0xca, + 0x86, 0xf1, 0xf5, 0x2b, 0xe0, 0xb1, 0x5c, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x8e, 0x3e, + 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa6, 0x00, 0xf9, 0x2e, 0x05, 0x02, 0x00, 0x00, +} + +func (m *DeployerParams) 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 *DeployerParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeployerParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintParams(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RollappsEnabled { + i-- + if m.RollappsEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if len(m.DeployerWhitelist) > 0 { + for iNdEx := len(m.DeployerWhitelist) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DeployerWhitelist[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.DisputePeriodInBlocks != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.DisputePeriodInBlocks)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *DeployerParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.DisputePeriodInBlocks != 0 { + n += 1 + sovParams(uint64(m.DisputePeriodInBlocks)) + } + if len(m.DeployerWhitelist) > 0 { + for _, e := range m.DeployerWhitelist { + l = e.Size() + n += 1 + l + sovParams(uint64(l)) + } + } + if m.RollappsEnabled { + n += 2 + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *DeployerParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeployerParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeployerParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisputePeriodInBlocks", wireType) + } + m.DisputePeriodInBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DisputePeriodInBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DeployerWhitelist", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DeployerWhitelist = append(m.DeployerWhitelist, DeployerParams{}) + if err := m.DeployerWhitelist[len(m.DeployerWhitelist)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappsEnabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RollappsEnabled = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/rollapp/types/query.pb.go b/x/rollapp/types/query.pb.go new file mode 100644 index 00000000..b7a353da --- /dev/null +++ b/x/rollapp/types/query.pb.go @@ -0,0 +1,3112 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollapp/query.proto + +package types + +import ( + context "context" + fmt "fmt" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "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 + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +type QueryGetRollappRequest struct { + RollappId string `protobuf:"bytes,1,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` +} + +func (m *QueryGetRollappRequest) Reset() { *m = QueryGetRollappRequest{} } +func (m *QueryGetRollappRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetRollappRequest) ProtoMessage() {} +func (*QueryGetRollappRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{2} +} +func (m *QueryGetRollappRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetRollappRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetRollappRequest.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 *QueryGetRollappRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetRollappRequest.Merge(m, src) +} +func (m *QueryGetRollappRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetRollappRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetRollappRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetRollappRequest proto.InternalMessageInfo + +func (m *QueryGetRollappRequest) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +type QueryGetRollappByEIP155Request struct { + Eip155 uint64 `protobuf:"varint,1,opt,name=eip155,proto3" json:"eip155,omitempty"` +} + +func (m *QueryGetRollappByEIP155Request) Reset() { *m = QueryGetRollappByEIP155Request{} } +func (m *QueryGetRollappByEIP155Request) String() string { return proto.CompactTextString(m) } +func (*QueryGetRollappByEIP155Request) ProtoMessage() {} +func (*QueryGetRollappByEIP155Request) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{3} +} +func (m *QueryGetRollappByEIP155Request) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetRollappByEIP155Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetRollappByEIP155Request.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 *QueryGetRollappByEIP155Request) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetRollappByEIP155Request.Merge(m, src) +} +func (m *QueryGetRollappByEIP155Request) XXX_Size() int { + return m.Size() +} +func (m *QueryGetRollappByEIP155Request) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetRollappByEIP155Request.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetRollappByEIP155Request proto.InternalMessageInfo + +func (m *QueryGetRollappByEIP155Request) GetEip155() uint64 { + if m != nil { + return m.Eip155 + } + return 0 +} + +type QueryGetLatestHeightRequest struct { + RollappId string `protobuf:"bytes,1,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` + Finalized bool `protobuf:"varint,2,opt,name=finalized,proto3" json:"finalized,omitempty"` +} + +func (m *QueryGetLatestHeightRequest) Reset() { *m = QueryGetLatestHeightRequest{} } +func (m *QueryGetLatestHeightRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetLatestHeightRequest) ProtoMessage() {} +func (*QueryGetLatestHeightRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{4} +} +func (m *QueryGetLatestHeightRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetLatestHeightRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetLatestHeightRequest.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 *QueryGetLatestHeightRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLatestHeightRequest.Merge(m, src) +} +func (m *QueryGetLatestHeightRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetLatestHeightRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLatestHeightRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetLatestHeightRequest proto.InternalMessageInfo + +func (m *QueryGetLatestHeightRequest) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *QueryGetLatestHeightRequest) GetFinalized() bool { + if m != nil { + return m.Finalized + } + return false +} + +type QueryGetLatestHeightResponse struct { + Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryGetLatestHeightResponse) Reset() { *m = QueryGetLatestHeightResponse{} } +func (m *QueryGetLatestHeightResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetLatestHeightResponse) ProtoMessage() {} +func (*QueryGetLatestHeightResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{5} +} +func (m *QueryGetLatestHeightResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetLatestHeightResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetLatestHeightResponse.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 *QueryGetLatestHeightResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLatestHeightResponse.Merge(m, src) +} +func (m *QueryGetLatestHeightResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetLatestHeightResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLatestHeightResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetLatestHeightResponse proto.InternalMessageInfo + +func (m *QueryGetLatestHeightResponse) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +type QueryGetLatestStateIndexRequest struct { + RollappId string `protobuf:"bytes,1,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` + Finalized bool `protobuf:"varint,2,opt,name=finalized,proto3" json:"finalized,omitempty"` +} + +func (m *QueryGetLatestStateIndexRequest) Reset() { *m = QueryGetLatestStateIndexRequest{} } +func (m *QueryGetLatestStateIndexRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetLatestStateIndexRequest) ProtoMessage() {} +func (*QueryGetLatestStateIndexRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{6} +} +func (m *QueryGetLatestStateIndexRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetLatestStateIndexRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetLatestStateIndexRequest.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 *QueryGetLatestStateIndexRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLatestStateIndexRequest.Merge(m, src) +} +func (m *QueryGetLatestStateIndexRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetLatestStateIndexRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLatestStateIndexRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetLatestStateIndexRequest proto.InternalMessageInfo + +func (m *QueryGetLatestStateIndexRequest) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *QueryGetLatestStateIndexRequest) GetFinalized() bool { + if m != nil { + return m.Finalized + } + return false +} + +type QueryGetLatestStateIndexResponse struct { + StateIndex StateInfoIndex `protobuf:"bytes,1,opt,name=state_index,json=stateIndex,proto3" json:"state_index"` +} + +func (m *QueryGetLatestStateIndexResponse) Reset() { *m = QueryGetLatestStateIndexResponse{} } +func (m *QueryGetLatestStateIndexResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetLatestStateIndexResponse) ProtoMessage() {} +func (*QueryGetLatestStateIndexResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{7} +} +func (m *QueryGetLatestStateIndexResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetLatestStateIndexResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetLatestStateIndexResponse.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 *QueryGetLatestStateIndexResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLatestStateIndexResponse.Merge(m, src) +} +func (m *QueryGetLatestStateIndexResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetLatestStateIndexResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLatestStateIndexResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetLatestStateIndexResponse proto.InternalMessageInfo + +func (m *QueryGetLatestStateIndexResponse) GetStateIndex() StateInfoIndex { + if m != nil { + return m.StateIndex + } + return StateInfoIndex{} +} + +type QueryGetRollappResponse struct { + Rollapp Rollapp `protobuf:"bytes,1,opt,name=rollapp,proto3" json:"rollapp"` + // Defines the index of the last rollapp UpdateState. + LatestStateIndex *StateInfoIndex `protobuf:"bytes,2,opt,name=latest_state_index,json=latestStateIndex,proto3" json:"latest_state_index,omitempty"` + // Defines the index of the last rollapp UpdateState that was finalized. + LatestFinalizedStateIndex *StateInfoIndex `protobuf:"bytes,3,opt,name=latest_finalized_state_index,json=latestFinalizedStateIndex,proto3" json:"latest_finalized_state_index,omitempty"` + LatestHeight uint64 `protobuf:"varint,4,opt,name=latest_height,json=latestHeight,proto3" json:"latest_height,omitempty"` + LatestFinalizedHeight uint64 `protobuf:"varint,5,opt,name=latest_finalized_height,json=latestFinalizedHeight,proto3" json:"latest_finalized_height,omitempty"` +} + +func (m *QueryGetRollappResponse) Reset() { *m = QueryGetRollappResponse{} } +func (m *QueryGetRollappResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetRollappResponse) ProtoMessage() {} +func (*QueryGetRollappResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{8} +} +func (m *QueryGetRollappResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetRollappResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetRollappResponse.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 *QueryGetRollappResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetRollappResponse.Merge(m, src) +} +func (m *QueryGetRollappResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetRollappResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetRollappResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetRollappResponse proto.InternalMessageInfo + +func (m *QueryGetRollappResponse) GetRollapp() Rollapp { + if m != nil { + return m.Rollapp + } + return Rollapp{} +} + +func (m *QueryGetRollappResponse) GetLatestStateIndex() *StateInfoIndex { + if m != nil { + return m.LatestStateIndex + } + return nil +} + +func (m *QueryGetRollappResponse) GetLatestFinalizedStateIndex() *StateInfoIndex { + if m != nil { + return m.LatestFinalizedStateIndex + } + return nil +} + +func (m *QueryGetRollappResponse) GetLatestHeight() uint64 { + if m != nil { + return m.LatestHeight + } + return 0 +} + +func (m *QueryGetRollappResponse) GetLatestFinalizedHeight() uint64 { + if m != nil { + return m.LatestFinalizedHeight + } + return 0 +} + +type QueryAllRollappRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllRollappRequest) Reset() { *m = QueryAllRollappRequest{} } +func (m *QueryAllRollappRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllRollappRequest) ProtoMessage() {} +func (*QueryAllRollappRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{9} +} +func (m *QueryAllRollappRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllRollappRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllRollappRequest.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 *QueryAllRollappRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllRollappRequest.Merge(m, src) +} +func (m *QueryAllRollappRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllRollappRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllRollappRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllRollappRequest proto.InternalMessageInfo + +func (m *QueryAllRollappRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryAllRollappResponse struct { + Rollapp []RollappSummary `protobuf:"bytes,1,rep,name=rollapp,proto3" json:"rollapp"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllRollappResponse) Reset() { *m = QueryAllRollappResponse{} } +func (m *QueryAllRollappResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllRollappResponse) ProtoMessage() {} +func (*QueryAllRollappResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{10} +} +func (m *QueryAllRollappResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllRollappResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllRollappResponse.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 *QueryAllRollappResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllRollappResponse.Merge(m, src) +} +func (m *QueryAllRollappResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllRollappResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllRollappResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllRollappResponse proto.InternalMessageInfo + +func (m *QueryAllRollappResponse) GetRollapp() []RollappSummary { + if m != nil { + return m.Rollapp + } + return nil +} + +func (m *QueryAllRollappResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryGetStateInfoRequest struct { + RollappId string `protobuf:"bytes,1,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` + Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` + Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` + Finalized bool `protobuf:"varint,4,opt,name=finalized,proto3" json:"finalized,omitempty"` +} + +func (m *QueryGetStateInfoRequest) Reset() { *m = QueryGetStateInfoRequest{} } +func (m *QueryGetStateInfoRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetStateInfoRequest) ProtoMessage() {} +func (*QueryGetStateInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{11} +} +func (m *QueryGetStateInfoRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetStateInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetStateInfoRequest.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 *QueryGetStateInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetStateInfoRequest.Merge(m, src) +} +func (m *QueryGetStateInfoRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetStateInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetStateInfoRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetStateInfoRequest proto.InternalMessageInfo + +func (m *QueryGetStateInfoRequest) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *QueryGetStateInfoRequest) GetIndex() uint64 { + if m != nil { + return m.Index + } + return 0 +} + +func (m *QueryGetStateInfoRequest) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *QueryGetStateInfoRequest) GetFinalized() bool { + if m != nil { + return m.Finalized + } + return false +} + +type QueryGetStateInfoResponse struct { + StateInfo StateInfo `protobuf:"bytes,1,opt,name=state_info,json=stateInfo,proto3" json:"state_info"` +} + +func (m *QueryGetStateInfoResponse) Reset() { *m = QueryGetStateInfoResponse{} } +func (m *QueryGetStateInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetStateInfoResponse) ProtoMessage() {} +func (*QueryGetStateInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_faa12a617c368b49, []int{12} +} +func (m *QueryGetStateInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetStateInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetStateInfoResponse.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 *QueryGetStateInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetStateInfoResponse.Merge(m, src) +} +func (m *QueryGetStateInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetStateInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetStateInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetStateInfoResponse proto.InternalMessageInfo + +func (m *QueryGetStateInfoResponse) GetStateInfo() StateInfo { + if m != nil { + return m.StateInfo + } + return StateInfo{} +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "nucleic.rollapp.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "nucleic.rollapp.QueryParamsResponse") + proto.RegisterType((*QueryGetRollappRequest)(nil), "nucleic.rollapp.QueryGetRollappRequest") + proto.RegisterType((*QueryGetRollappByEIP155Request)(nil), "nucleic.rollapp.QueryGetRollappByEIP155Request") + proto.RegisterType((*QueryGetLatestHeightRequest)(nil), "nucleic.rollapp.QueryGetLatestHeightRequest") + proto.RegisterType((*QueryGetLatestHeightResponse)(nil), "nucleic.rollapp.QueryGetLatestHeightResponse") + proto.RegisterType((*QueryGetLatestStateIndexRequest)(nil), "nucleic.rollapp.QueryGetLatestStateIndexRequest") + proto.RegisterType((*QueryGetLatestStateIndexResponse)(nil), "nucleic.rollapp.QueryGetLatestStateIndexResponse") + proto.RegisterType((*QueryGetRollappResponse)(nil), "nucleic.rollapp.QueryGetRollappResponse") + proto.RegisterType((*QueryAllRollappRequest)(nil), "nucleic.rollapp.QueryAllRollappRequest") + proto.RegisterType((*QueryAllRollappResponse)(nil), "nucleic.rollapp.QueryAllRollappResponse") + proto.RegisterType((*QueryGetStateInfoRequest)(nil), "nucleic.rollapp.QueryGetStateInfoRequest") + proto.RegisterType((*QueryGetStateInfoResponse)(nil), "nucleic.rollapp.QueryGetStateInfoResponse") +} + +func init() { proto.RegisterFile("nucleic/rollapp/query.proto", fileDescriptor_faa12a617c368b49) } + +var fileDescriptor_faa12a617c368b49 = []byte{ + // 897 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x4f, 0x2b, 0x55, + 0x14, 0xee, 0x94, 0xd2, 0xf7, 0x7a, 0xde, 0x33, 0xef, 0xe5, 0x8a, 0xb4, 0x0c, 0xa5, 0x6d, 0x06, + 0x95, 0x8a, 0x76, 0x86, 0x96, 0x14, 0xd9, 0x19, 0x48, 0x04, 0x49, 0x30, 0xc1, 0x61, 0x47, 0x8c, + 0x30, 0x6d, 0x2f, 0xc3, 0xe8, 0x74, 0x66, 0xe8, 0x4c, 0x95, 0x4a, 0x58, 0x68, 0xe2, 0xca, 0x8d, + 0x89, 0x89, 0x2b, 0x63, 0x4c, 0xfc, 0x0b, 0xfc, 0x2f, 0x58, 0x92, 0xb8, 0x71, 0x65, 0x14, 0xfc, + 0x43, 0x4c, 0xef, 0x3d, 0xd3, 0xce, 0x8f, 0x8e, 0x2d, 0xc9, 0x5b, 0x95, 0xde, 0x7b, 0xce, 0xf7, + 0x7d, 0x3d, 0xdf, 0x3d, 0xe7, 0x00, 0xcb, 0x56, 0xbf, 0x6d, 0x52, 0xa3, 0xad, 0xf4, 0x6c, 0xd3, + 0xd4, 0x1c, 0x47, 0xb9, 0xec, 0xd3, 0xde, 0x40, 0x76, 0x7a, 0xb6, 0x67, 0x93, 0x17, 0x78, 0x29, + 0xe3, 0xa5, 0xb8, 0xa0, 0xdb, 0xba, 0xcd, 0xee, 0x94, 0xe1, 0x5f, 0x3c, 0x4c, 0x2c, 0xea, 0xb6, + 0xad, 0x9b, 0x54, 0xd1, 0x1c, 0x43, 0xd1, 0x2c, 0xcb, 0xf6, 0x34, 0xcf, 0xb0, 0x2d, 0x17, 0x6f, + 0xd7, 0xdb, 0xb6, 0xdb, 0xb5, 0x5d, 0xa5, 0xa5, 0xb9, 0x94, 0xa3, 0x2b, 0x5f, 0xd6, 0x5b, 0xd4, + 0xd3, 0xea, 0x8a, 0xa3, 0xe9, 0x86, 0xc5, 0x82, 0x7d, 0xa4, 0xa8, 0x1a, 0x47, 0xeb, 0x69, 0x5d, + 0x1f, 0x69, 0x25, 0x7a, 0x8b, 0x9f, 0x78, 0x5d, 0x89, 0x5e, 0xbb, 0x9e, 0xe6, 0xd1, 0x53, 0xc3, + 0x3a, 0x47, 0xa1, 0xd2, 0x02, 0x90, 0x4f, 0x86, 0x02, 0x8e, 0x18, 0xaa, 0x4a, 0x2f, 0xfb, 0xd4, + 0xf5, 0xa4, 0x43, 0x78, 0x3d, 0x74, 0xea, 0x3a, 0xb6, 0xe5, 0x52, 0xd2, 0x84, 0x2c, 0x67, 0x2f, + 0x08, 0x15, 0xa1, 0xfa, 0xac, 0x91, 0x97, 0x23, 0xd5, 0x90, 0x79, 0xc2, 0x6e, 0xe6, 0xf6, 0xaf, + 0x72, 0x4a, 0xc5, 0x60, 0xe9, 0x7d, 0x58, 0x64, 0x68, 0xfb, 0xd4, 0x53, 0x79, 0x1c, 0xf2, 0x90, + 0x15, 0x00, 0xcc, 0x3c, 0x35, 0x3a, 0x0c, 0x34, 0xa7, 0xe6, 0xf0, 0xe4, 0xa0, 0x23, 0x6d, 0x43, + 0x29, 0x92, 0xb8, 0x3b, 0xf8, 0xf0, 0xe0, 0xa8, 0xde, 0x6c, 0xfa, 0x00, 0x8b, 0x90, 0xa5, 0x86, + 0x53, 0x6f, 0x36, 0x59, 0x72, 0x46, 0xc5, 0x6f, 0xd2, 0x09, 0x2c, 0xfb, 0x99, 0x87, 0x9a, 0x47, + 0x5d, 0xef, 0x23, 0x6a, 0xe8, 0x17, 0xde, 0x6c, 0xbc, 0xa4, 0x08, 0xb9, 0x73, 0xc3, 0xd2, 0x4c, + 0xe3, 0x6b, 0xda, 0x29, 0xa4, 0x2b, 0x42, 0xf5, 0xa9, 0x3a, 0x3e, 0x90, 0xb6, 0xa0, 0x38, 0x19, + 0x1b, 0xab, 0xb4, 0x08, 0xd9, 0x0b, 0x76, 0xe2, 0x6b, 0xe2, 0xdf, 0xa4, 0xcf, 0xa0, 0x1c, 0xce, + 0x3b, 0x1e, 0x9a, 0x71, 0x60, 0x75, 0xe8, 0xd5, 0x2b, 0xd1, 0xf5, 0x39, 0x54, 0x92, 0xf1, 0x51, + 0xdb, 0x1e, 0x3c, 0xf3, 0x9f, 0x40, 0x87, 0x5e, 0xa1, 0x8d, 0xe5, 0x98, 0x8d, 0x98, 0x79, 0x6e, + 0xb3, 0x6c, 0xb4, 0x13, 0xdc, 0x11, 0x9e, 0xf4, 0x4f, 0x1a, 0xf2, 0x31, 0x4f, 0x91, 0x63, 0x1b, + 0x9e, 0x20, 0x0e, 0xe2, 0x17, 0x62, 0xf8, 0xbe, 0x9b, 0x1c, 0xd8, 0x0f, 0x27, 0x1f, 0x03, 0x31, + 0x99, 0xf2, 0xd3, 0xa0, 0xc8, 0xf4, 0x4c, 0x22, 0xd5, 0x97, 0x66, 0xe4, 0x47, 0x93, 0x33, 0x28, + 0x22, 0xdc, 0xa8, 0x48, 0x21, 0xe0, 0xb9, 0xd9, 0x80, 0x97, 0x38, 0xc8, 0x9e, 0x8f, 0x11, 0x60, + 0x58, 0x85, 0xd7, 0x90, 0x01, 0x1d, 0xcf, 0x30, 0xc7, 0x9f, 0x9b, 0x81, 0x77, 0x41, 0xb6, 0x20, + 0x1f, 0x93, 0x81, 0xe1, 0xf3, 0x2c, 0xfc, 0x8d, 0x08, 0x01, 0xcf, 0x93, 0xce, 0xb0, 0x6d, 0x76, + 0x4c, 0x33, 0xd2, 0x36, 0x7b, 0x00, 0xe3, 0x39, 0x81, 0x45, 0x7e, 0x5b, 0xe6, 0x43, 0x45, 0x1e, + 0x0e, 0x15, 0x99, 0x8f, 0x2c, 0x1c, 0x2a, 0xf2, 0x91, 0xa6, 0x53, 0xcc, 0x55, 0x03, 0x99, 0xd2, + 0x6f, 0x02, 0xba, 0x18, 0xa4, 0x40, 0x17, 0x3f, 0x08, 0xba, 0x38, 0x37, 0xb1, 0x4e, 0x98, 0x72, + 0xdc, 0xef, 0x76, 0xb5, 0xde, 0x20, 0x6a, 0xe6, 0x7e, 0x48, 0x24, 0x37, 0x71, 0x6d, 0xaa, 0x48, + 0xce, 0x1e, 0x52, 0xf9, 0x9d, 0x00, 0x05, 0xff, 0xad, 0x8d, 0xac, 0x99, 0xb1, 0x63, 0x16, 0x60, + 0x7e, 0xfc, 0x88, 0x32, 0x2a, 0xff, 0x12, 0xe8, 0xd0, 0xb9, 0x60, 0x87, 0x86, 0xfb, 0x2b, 0x13, + 0xed, 0xaf, 0x4f, 0x61, 0x69, 0x82, 0x8c, 0x51, 0xb9, 0x60, 0x3c, 0x5b, 0xd1, 0x12, 0x31, 0xf9, + 0x65, 0x61, 0xb1, 0x72, 0xae, 0x7f, 0xd0, 0xf8, 0xe5, 0x29, 0xcc, 0x33, 0x78, 0xe2, 0x41, 0x96, + 0x8f, 0x51, 0xb2, 0x1a, 0x03, 0x88, 0xcf, 0x6a, 0xf1, 0xcd, 0xff, 0x0f, 0xe2, 0xfa, 0xa4, 0xf2, + 0xb7, 0x7f, 0xfc, 0xfb, 0x63, 0x7a, 0x89, 0xe4, 0x95, 0xc9, 0xfb, 0x84, 0x7c, 0x2f, 0xc0, 0x13, + 0x34, 0x94, 0xac, 0x4d, 0x86, 0x8c, 0xcd, 0x6f, 0xb1, 0x3a, 0x3d, 0x10, 0xf9, 0x6b, 0x8c, 0x7f, + 0x8d, 0xbc, 0xa5, 0x24, 0x6c, 0x2c, 0xe5, 0x7a, 0xec, 0xe3, 0x0d, 0xf9, 0x49, 0x80, 0x17, 0x91, + 0x91, 0x4f, 0x94, 0x69, 0x64, 0x91, 0xe5, 0xf0, 0x08, 0x75, 0x55, 0xa6, 0x4e, 0x22, 0x95, 0x98, + 0x3a, 0xbe, 0x4f, 0x94, 0x6b, 0xfe, 0x79, 0x43, 0xbe, 0x11, 0x00, 0x30, 0x7b, 0xc7, 0x34, 0x93, + 0x2a, 0x15, 0x6b, 0xd9, 0x24, 0x2d, 0xf1, 0xc6, 0x93, 0x2a, 0x4c, 0x8b, 0x48, 0x0a, 0x49, 0x95, + 0x22, 0xbf, 0x0a, 0xf0, 0x3c, 0xb8, 0x79, 0xc8, 0x7b, 0x89, 0x3f, 0x74, 0xc2, 0xf2, 0x13, 0x6b, + 0x33, 0x46, 0xa3, 0x9e, 0x4d, 0xa6, 0xa7, 0x46, 0xde, 0x8d, 0xe9, 0x09, 0x8d, 0xbe, 0xb0, 0x7f, + 0xbf, 0x0b, 0xf0, 0x32, 0xba, 0x84, 0xc8, 0xc6, 0x14, 0xe2, 0xd8, 0x3e, 0x14, 0xeb, 0x8f, 0xc8, + 0x40, 0xb9, 0xdb, 0x4c, 0x6e, 0x83, 0x6c, 0x24, 0xc9, 0x0d, 0x6c, 0x80, 0xb0, 0xe6, 0x9f, 0x05, + 0xc8, 0x8d, 0x1a, 0x94, 0xbc, 0x93, 0x48, 0x1d, 0x9d, 0x41, 0xe2, 0xfa, 0x2c, 0xa1, 0x53, 0xe5, + 0x8d, 0xc7, 0x47, 0x48, 0x96, 0x72, 0xcd, 0xa4, 0xde, 0xec, 0x1e, 0xde, 0xde, 0x97, 0x84, 0xbb, + 0xfb, 0x92, 0xf0, 0xf7, 0x7d, 0x49, 0xf8, 0xe1, 0xa1, 0x94, 0xba, 0x7b, 0x28, 0xa5, 0xfe, 0x7c, + 0x28, 0xa5, 0x4e, 0x1a, 0xba, 0xe1, 0x5d, 0xf4, 0x5b, 0x72, 0xdb, 0xee, 0xfa, 0xa8, 0x35, 0x8b, + 0x7a, 0x5f, 0xd9, 0xbd, 0x2f, 0x46, 0x2c, 0x57, 0x23, 0x1e, 0x6f, 0xe0, 0x50, 0xb7, 0x95, 0x65, + 0xff, 0xfe, 0x6d, 0xfe, 0x17, 0x00, 0x00, 0xff, 0xff, 0x66, 0x5a, 0x8a, 0xa5, 0xed, 0x0a, 0x00, + 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Parameters queries the parameters of the module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Queries a Rollapp by index. + Rollapp(ctx context.Context, in *QueryGetRollappRequest, opts ...grpc.CallOption) (*QueryGetRollappResponse, error) + // Queries a Rollapp by index. + RollappByEIP155(ctx context.Context, in *QueryGetRollappByEIP155Request, opts ...grpc.CallOption) (*QueryGetRollappResponse, error) + // Queries a list of Rollapp items. + RollappAll(ctx context.Context, in *QueryAllRollappRequest, opts ...grpc.CallOption) (*QueryAllRollappResponse, error) + // Queries a LatestHeight by rollapp-id. + LatestHeight(ctx context.Context, in *QueryGetLatestHeightRequest, opts ...grpc.CallOption) (*QueryGetLatestHeightResponse, error) + // Queries a LatestStateIndex by rollapp-id. + LatestStateIndex(ctx context.Context, in *QueryGetLatestStateIndexRequest, opts ...grpc.CallOption) (*QueryGetLatestStateIndexResponse, error) + // Queries a StateInfo by index. + StateInfo(ctx context.Context, in *QueryGetStateInfoRequest, opts ...grpc.CallOption) (*QueryGetStateInfoResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Rollapp(ctx context.Context, in *QueryGetRollappRequest, opts ...grpc.CallOption) (*QueryGetRollappResponse, error) { + out := new(QueryGetRollappResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Query/Rollapp", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) RollappByEIP155(ctx context.Context, in *QueryGetRollappByEIP155Request, opts ...grpc.CallOption) (*QueryGetRollappResponse, error) { + out := new(QueryGetRollappResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Query/RollappByEIP155", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) RollappAll(ctx context.Context, in *QueryAllRollappRequest, opts ...grpc.CallOption) (*QueryAllRollappResponse, error) { + out := new(QueryAllRollappResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Query/RollappAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) LatestHeight(ctx context.Context, in *QueryGetLatestHeightRequest, opts ...grpc.CallOption) (*QueryGetLatestHeightResponse, error) { + out := new(QueryGetLatestHeightResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Query/LatestHeight", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) LatestStateIndex(ctx context.Context, in *QueryGetLatestStateIndexRequest, opts ...grpc.CallOption) (*QueryGetLatestStateIndexResponse, error) { + out := new(QueryGetLatestStateIndexResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Query/LatestStateIndex", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) StateInfo(ctx context.Context, in *QueryGetStateInfoRequest, opts ...grpc.CallOption) (*QueryGetStateInfoResponse, error) { + out := new(QueryGetStateInfoResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Query/StateInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Queries a Rollapp by index. + Rollapp(context.Context, *QueryGetRollappRequest) (*QueryGetRollappResponse, error) + // Queries a Rollapp by index. + RollappByEIP155(context.Context, *QueryGetRollappByEIP155Request) (*QueryGetRollappResponse, error) + // Queries a list of Rollapp items. + RollappAll(context.Context, *QueryAllRollappRequest) (*QueryAllRollappResponse, error) + // Queries a LatestHeight by rollapp-id. + LatestHeight(context.Context, *QueryGetLatestHeightRequest) (*QueryGetLatestHeightResponse, error) + // Queries a LatestStateIndex by rollapp-id. + LatestStateIndex(context.Context, *QueryGetLatestStateIndexRequest) (*QueryGetLatestStateIndexResponse, error) + // Queries a StateInfo by index. + StateInfo(context.Context, *QueryGetStateInfoRequest) (*QueryGetStateInfoResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) Rollapp(ctx context.Context, req *QueryGetRollappRequest) (*QueryGetRollappResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Rollapp not implemented") +} +func (*UnimplementedQueryServer) RollappByEIP155(ctx context.Context, req *QueryGetRollappByEIP155Request) (*QueryGetRollappResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RollappByEIP155 not implemented") +} +func (*UnimplementedQueryServer) RollappAll(ctx context.Context, req *QueryAllRollappRequest) (*QueryAllRollappResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RollappAll not implemented") +} +func (*UnimplementedQueryServer) LatestHeight(ctx context.Context, req *QueryGetLatestHeightRequest) (*QueryGetLatestHeightResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LatestHeight not implemented") +} +func (*UnimplementedQueryServer) LatestStateIndex(ctx context.Context, req *QueryGetLatestStateIndexRequest) (*QueryGetLatestStateIndexResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LatestStateIndex not implemented") +} +func (*UnimplementedQueryServer) StateInfo(ctx context.Context, req *QueryGetStateInfoRequest) (*QueryGetStateInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StateInfo not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Rollapp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetRollappRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Rollapp(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Query/Rollapp", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Rollapp(ctx, req.(*QueryGetRollappRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_RollappByEIP155_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetRollappByEIP155Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RollappByEIP155(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Query/RollappByEIP155", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RollappByEIP155(ctx, req.(*QueryGetRollappByEIP155Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_RollappAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllRollappRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RollappAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Query/RollappAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RollappAll(ctx, req.(*QueryAllRollappRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_LatestHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetLatestHeightRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).LatestHeight(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Query/LatestHeight", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).LatestHeight(ctx, req.(*QueryGetLatestHeightRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_LatestStateIndex_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetLatestStateIndexRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).LatestStateIndex(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Query/LatestStateIndex", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).LatestStateIndex(ctx, req.(*QueryGetLatestStateIndexRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_StateInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetStateInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).StateInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Query/StateInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).StateInfo(ctx, req.(*QueryGetStateInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "nucleic.rollapp.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "Rollapp", + Handler: _Query_Rollapp_Handler, + }, + { + MethodName: "RollappByEIP155", + Handler: _Query_RollappByEIP155_Handler, + }, + { + MethodName: "RollappAll", + Handler: _Query_RollappAll_Handler, + }, + { + MethodName: "LatestHeight", + Handler: _Query_LatestHeight_Handler, + }, + { + MethodName: "LatestStateIndex", + Handler: _Query_LatestStateIndex_Handler, + }, + { + MethodName: "StateInfo", + Handler: _Query_StateInfo_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "nucleic/rollapp/query.proto", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryGetRollappRequest) 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 *QueryGetRollappRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetRollappRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetRollappByEIP155Request) 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 *QueryGetRollappByEIP155Request) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetRollappByEIP155Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Eip155 != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Eip155)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryGetLatestHeightRequest) 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 *QueryGetLatestHeightRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetLatestHeightRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Finalized { + i-- + if m.Finalized { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetLatestHeightResponse) 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 *QueryGetLatestHeightResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetLatestHeightResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryGetLatestStateIndexRequest) 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 *QueryGetLatestStateIndexRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetLatestStateIndexRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Finalized { + i-- + if m.Finalized { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetLatestStateIndexResponse) 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 *QueryGetLatestStateIndexResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetLatestStateIndexResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.StateIndex.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 *QueryGetRollappResponse) 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 *QueryGetRollappResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetRollappResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LatestFinalizedHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.LatestFinalizedHeight)) + i-- + dAtA[i] = 0x28 + } + if m.LatestHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.LatestHeight)) + i-- + dAtA[i] = 0x20 + } + if m.LatestFinalizedStateIndex != nil { + { + size, err := m.LatestFinalizedStateIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.LatestStateIndex != nil { + { + size, err := m.LatestStateIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Rollapp.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 *QueryAllRollappRequest) 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 *QueryAllRollappRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllRollappRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllRollappResponse) 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 *QueryAllRollappResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllRollappResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Rollapp) > 0 { + for iNdEx := len(m.Rollapp) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rollapp[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 *QueryGetStateInfoRequest) 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 *QueryGetStateInfoRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetStateInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Finalized { + i-- + if m.Finalized { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x18 + } + if m.Index != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x10 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetStateInfoResponse) 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 *QueryGetStateInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetStateInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.StateInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetRollappRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetRollappByEIP155Request) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Eip155 != 0 { + n += 1 + sovQuery(uint64(m.Eip155)) + } + return n +} + +func (m *QueryGetLatestHeightRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Finalized { + n += 2 + } + return n +} + +func (m *QueryGetLatestHeightResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + return n +} + +func (m *QueryGetLatestStateIndexRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Finalized { + n += 2 + } + return n +} + +func (m *QueryGetLatestStateIndexResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.StateIndex.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGetRollappResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Rollapp.Size() + n += 1 + l + sovQuery(uint64(l)) + if m.LatestStateIndex != nil { + l = m.LatestStateIndex.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.LatestFinalizedStateIndex != nil { + l = m.LatestFinalizedStateIndex.Size() + n += 1 + l + sovQuery(uint64(l)) + } + if m.LatestHeight != 0 { + n += 1 + sovQuery(uint64(m.LatestHeight)) + } + if m.LatestFinalizedHeight != 0 { + n += 1 + sovQuery(uint64(m.LatestFinalizedHeight)) + } + return n +} + +func (m *QueryAllRollappRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllRollappResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Rollapp) > 0 { + for _, e := range m.Rollapp { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGetStateInfoRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Index != 0 { + n += 1 + sovQuery(uint64(m.Index)) + } + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + if m.Finalized { + n += 2 + } + return n +} + +func (m *QueryGetStateInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.StateInfo.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetRollappRequest) 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: QueryGetRollappRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetRollappRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetRollappByEIP155Request) 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: QueryGetRollappByEIP155Request: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetRollappByEIP155Request: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Eip155", wireType) + } + m.Eip155 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Eip155 |= 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 *QueryGetLatestHeightRequest) 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: QueryGetLatestHeightRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetLatestHeightRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Finalized", 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.Finalized = bool(v != 0) + 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 *QueryGetLatestHeightResponse) 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: QueryGetLatestHeightResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetLatestHeightResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= 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 *QueryGetLatestStateIndexRequest) 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: QueryGetLatestStateIndexRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetLatestStateIndexRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Finalized", 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.Finalized = bool(v != 0) + 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 *QueryGetLatestStateIndexResponse) 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: QueryGetLatestStateIndexResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetLatestStateIndexResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateIndex", 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.StateIndex.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 *QueryGetRollappResponse) 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: QueryGetRollappResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetRollappResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rollapp", 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.Rollapp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestStateIndex", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LatestStateIndex == nil { + m.LatestStateIndex = &StateInfoIndex{} + } + if err := m.LatestStateIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestFinalizedStateIndex", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LatestFinalizedStateIndex == nil { + m.LatestFinalizedStateIndex = &StateInfoIndex{} + } + if err := m.LatestFinalizedStateIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestHeight", wireType) + } + m.LatestHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LatestHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestFinalizedHeight", wireType) + } + m.LatestFinalizedHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LatestFinalizedHeight |= 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 *QueryAllRollappRequest) 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: QueryAllRollappRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllRollappRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllRollappResponse) 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: QueryAllRollappResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllRollappResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rollapp", 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.Rollapp = append(m.Rollapp, RollappSummary{}) + if err := m.Rollapp[len(m.Rollapp)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetStateInfoRequest) 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: QueryGetStateInfoRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetStateInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + m.Index = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Index |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Finalized", 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.Finalized = bool(v != 0) + 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 *QueryGetStateInfoResponse) 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: QueryGetStateInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetStateInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateInfo", 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.StateInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/rollapp/types/query.pb.gw.go b/x/rollapp/types/query.pb.gw.go new file mode 100644 index 00000000..dbb54666 --- /dev/null +++ b/x/rollapp/types/query.pb.gw.go @@ -0,0 +1,817 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: nucleic/rollapp/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Rollapp_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRollappRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollapp_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollapp_id") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollapp_id", err) + } + + msg, err := client.Rollapp(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Rollapp_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRollappRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollapp_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollapp_id") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollapp_id", err) + } + + msg, err := server.Rollapp(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_RollappByEIP155_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRollappByEIP155Request + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["eip155"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "eip155") + } + + protoReq.Eip155, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "eip155", err) + } + + msg, err := client.RollappByEIP155(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_RollappByEIP155_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetRollappByEIP155Request + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["eip155"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "eip155") + } + + protoReq.Eip155, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "eip155", err) + } + + msg, err := server.RollappByEIP155(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_RollappAll_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_RollappAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllRollappRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RollappAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RollappAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_RollappAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllRollappRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RollappAll_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RollappAll(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_LatestHeight_0 = &utilities.DoubleArray{Encoding: map[string]int{"rollapp_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_LatestHeight_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetLatestHeightRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollapp_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollapp_id") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollapp_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LatestHeight_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.LatestHeight(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_LatestHeight_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetLatestHeightRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollapp_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollapp_id") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollapp_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LatestHeight_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.LatestHeight(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_LatestStateIndex_0 = &utilities.DoubleArray{Encoding: map[string]int{"rollapp_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_LatestStateIndex_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetLatestStateIndexRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollapp_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollapp_id") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollapp_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LatestStateIndex_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.LatestStateIndex(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_LatestStateIndex_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetLatestStateIndexRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollapp_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollapp_id") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollapp_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LatestStateIndex_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.LatestStateIndex(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_StateInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{"rollapp_id": 0, "index": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} +) + +func request_Query_StateInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetStateInfoRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollapp_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollapp_id") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollapp_id", err) + } + + val, ok = pathParams["index"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index") + } + + protoReq.Index, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_StateInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.StateInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_StateInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetStateInfoRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["rollapp_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "rollapp_id") + } + + protoReq.RollappId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "rollapp_id", err) + } + + val, ok = pathParams["index"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "index") + } + + protoReq.Index, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "index", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_StateInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.StateInfo(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Rollapp_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_Rollapp_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_Rollapp_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RollappByEIP155_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_RollappByEIP155_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_RollappByEIP155_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RollappAll_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_RollappAll_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_RollappAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LatestHeight_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_LatestHeight_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_LatestHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LatestStateIndex_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_LatestStateIndex_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_LatestStateIndex_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_StateInfo_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_StateInfo_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_StateInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Rollapp_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_Rollapp_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_Rollapp_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RollappByEIP155_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_RollappByEIP155_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_RollappByEIP155_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RollappAll_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_RollappAll_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_RollappAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LatestHeight_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_LatestHeight_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_LatestHeight_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LatestStateIndex_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_LatestStateIndex_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_LatestStateIndex_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_StateInfo_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_StateInfo_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_StateInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"nucleic", "rollapp", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Rollapp_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"nucleic", "rollapp", "rollapp_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_RollappByEIP155_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 2}, []string{"nucleic", "rollapp", "eip155"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_RollappAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 1}, []string{"nucleic", "rollapp"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_LatestHeight_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"nucleic", "rollapp", "latest_height", "rollapp_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_LatestStateIndex_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"nucleic", "rollapp", "latest_state_index", "rollapp_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_StateInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"nucleic", "rollapp", "state_info", "rollapp_id", "index"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_Rollapp_0 = runtime.ForwardResponseMessage + + forward_Query_RollappByEIP155_0 = runtime.ForwardResponseMessage + + forward_Query_RollappAll_0 = runtime.ForwardResponseMessage + + forward_Query_LatestHeight_0 = runtime.ForwardResponseMessage + + forward_Query_LatestStateIndex_0 = runtime.ForwardResponseMessage + + forward_Query_StateInfo_0 = runtime.ForwardResponseMessage +) diff --git a/x/rollapp/types/rollapp.go b/x/rollapp/types/rollapp.go new file mode 100644 index 00000000..86b7858a --- /dev/null +++ b/x/rollapp/types/rollapp.go @@ -0,0 +1,81 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const MaxAllowedSequencers = 100 + +func NewRollapp(creator, rollappId string, maxSequencers uint64, permissionedAddresses []string, + metadatas []*TokenMetadata, genesisAccounts RollappGenesisState, +) Rollapp { + return Rollapp{ + RollappId: rollappId, + Creator: creator, + MaxSequencers: maxSequencers, + PermissionedAddresses: permissionedAddresses, + GenesisState: genesisAccounts, + TokenMetadata: metadatas, + } +} + +func (r Rollapp) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(r.Creator) + if err != nil { + return errorsmod.Wrap(err, ErrInvalidCreatorAddress.Error()) + } + + // validate rollappId + _, err = NewChainID(r.RollappId) + if err != nil { + return err + } + + if r.MaxSequencers > MaxAllowedSequencers { + return errorsmod.Wrapf(ErrInvalidMaxSequencers, "max sequencers: %d, max sequencers allowed: %d", r.GetMaxSequencers(), MaxAllowedSequencers) + } + if uint64(len(r.PermissionedAddresses)) > r.GetMaxSequencers() { + return errorsmod.Wrapf(ErrTooManyPermissionedAddresses, "permissioned addresses: %d, max sequencers: %d", len(r.PermissionedAddresses), r.GetMaxSequencers()) + } + + // verifies that there's no duplicate address in PermissionedAddresses + // and addresses are in Bech32 format + permissionedAddresses := r.GetPermissionedAddresses() + if len(permissionedAddresses) > 0 { + duplicateAddresses := make(map[string]bool) + for _, item := range permissionedAddresses { + // check if the item/element exist in the duplicateAddresses map + _, exist := duplicateAddresses[item] + if exist { + return errorsmod.Wrapf(ErrPermissionedAddressesDuplicate, "address: %s", item) + } + // check Bech32 format + if _, err := sdk.AccAddressFromBech32(item); err != nil { + return errorsmod.Wrapf(ErrInvalidPermissionedAddress, "%s", err) + } + // mark as exist + duplicateAddresses[item] = true + } + } + + // verifies that token metadata, if any, must be valid + if len(r.TokenMetadata) > 0 { + for _, metadata := range r.TokenMetadata { + if err := metadata.Validate(); err != nil { + return errorsmod.Wrapf(ErrInvalidTokenMetadata, "%s: %v", metadata.Base, err) + } + } + } + + // genesisAccounts address validation + for _, acc := range r.GenesisState.GenesisAccounts { + _, err := sdk.AccAddressFromBech32(acc.Address) + if err != nil { + return errorsmod.Wrapf(err, "invalid genesis account address (%s)", acc.Address) + } + } + + return nil +} diff --git a/x/rollapp/types/rollapp.pb.go b/x/rollapp/types/rollapp.pb.go new file mode 100644 index 00000000..575d552e --- /dev/null +++ b/x/rollapp/types/rollapp.pb.go @@ -0,0 +1,1492 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollapp/rollapp.proto + +package types + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "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 + +// GenesisAccount is a struct for the genesis account for the rollapp +type GenesisAccount struct { + // amount of coins to be sent to the genesis address + Amount types.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount"` + // address is a bech-32 address of the genesis account + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *GenesisAccount) Reset() { *m = GenesisAccount{} } +func (m *GenesisAccount) String() string { return proto.CompactTextString(m) } +func (*GenesisAccount) ProtoMessage() {} +func (*GenesisAccount) Descriptor() ([]byte, []int) { + return fileDescriptor_aecaa292d97582fe, []int{0} +} +func (m *GenesisAccount) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisAccount.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 *GenesisAccount) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisAccount.Merge(m, src) +} +func (m *GenesisAccount) XXX_Size() int { + return m.Size() +} +func (m *GenesisAccount) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisAccount.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisAccount proto.InternalMessageInfo + +func (m *GenesisAccount) GetAmount() types.Coin { + if m != nil { + return m.Amount + } + return types.Coin{} +} + +func (m *GenesisAccount) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +// RollappGenesisState is a partial repr of the state the hub can expect the +// rollapp to be in upon genesis +type RollappGenesisState struct { + // genesis_accounts is a list of token allocations + GenesisAccounts []*GenesisAccount `protobuf:"bytes,1,rep,name=genesis_accounts,json=genesisAccounts,proto3" json:"genesis_accounts,omitempty"` + // is_genesis_event is a boolean that indicates if the genesis event has + // occured + IsGenesisEvent bool `protobuf:"varint,2,opt,name=is_genesis_event,json=isGenesisEvent,proto3" json:"is_genesis_event,omitempty"` +} + +func (m *RollappGenesisState) Reset() { *m = RollappGenesisState{} } +func (m *RollappGenesisState) String() string { return proto.CompactTextString(m) } +func (*RollappGenesisState) ProtoMessage() {} +func (*RollappGenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_aecaa292d97582fe, []int{1} +} +func (m *RollappGenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RollappGenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RollappGenesisState.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 *RollappGenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_RollappGenesisState.Merge(m, src) +} +func (m *RollappGenesisState) XXX_Size() int { + return m.Size() +} +func (m *RollappGenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_RollappGenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_RollappGenesisState proto.InternalMessageInfo + +func (m *RollappGenesisState) GetGenesisAccounts() []*GenesisAccount { + if m != nil { + return m.GenesisAccounts + } + return nil +} + +func (m *RollappGenesisState) GetIsGenesisEvent() bool { + if m != nil { + return m.IsGenesisEvent + } + return false +} + +// Rollapp defines a rollapp object. First the RollApp is created and then +// sequencers can be created and attached. The RollApp is identified by +// rollapp_id +type Rollapp struct { + // The unique identifier of the rollapp chain. + // The rollapp_id follows the same standard as cosmos chain_id. + RollappId string `protobuf:"bytes,1,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` + // creator is the bech32-encoded address of the rollapp creator. + Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` + // version is the software and configuration version. + // starts from 1 and increases by one on every MsgUpdateState + Version uint64 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` + // max_sequencers is the maximum number of sequencers. + MaxSequencers uint64 `protobuf:"varint,4,opt,name=max_sequencers,json=maxSequencers,proto3" json:"max_sequencers,omitempty"` + // permissioned_addresses is a bech32-encoded address list of the sequencers + // that are allowed to serve this rollapp_id. In the case of an empty list, + // the rollapp is considered permissionless. + PermissionedAddresses []string `protobuf:"bytes,5,rep,name=permissioned_addresses,json=permissionedAddresses,proto3" json:"permissioned_addresses,omitempty"` + // token_metadata is a list of TokenMetadata that are registered on this + // rollapp + TokenMetadata []*TokenMetadata `protobuf:"bytes,6,rep,name=token_metadata,json=tokenMetadata,proto3" json:"token_metadata,omitempty"` + // genesis_state is a partial repr of the state the hub can expect the rollapp + // to be in upon genesis + GenesisState RollappGenesisState `protobuf:"bytes,7,opt,name=genesis_state,json=genesisState,proto3" json:"genesis_state"` + // channel_id will be set to the canonical IBC channel of the rollapp. + ChannelId string `protobuf:"bytes,8,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // frozen is a boolean that indicates if the rollapp is frozen. + Frozen bool `protobuf:"varint,9,opt,name=frozen,proto3" json:"frozen,omitempty"` +} + +func (m *Rollapp) Reset() { *m = Rollapp{} } +func (m *Rollapp) String() string { return proto.CompactTextString(m) } +func (*Rollapp) ProtoMessage() {} +func (*Rollapp) Descriptor() ([]byte, []int) { + return fileDescriptor_aecaa292d97582fe, []int{2} +} +func (m *Rollapp) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Rollapp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Rollapp.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 *Rollapp) XXX_Merge(src proto.Message) { + xxx_messageInfo_Rollapp.Merge(m, src) +} +func (m *Rollapp) XXX_Size() int { + return m.Size() +} +func (m *Rollapp) XXX_DiscardUnknown() { + xxx_messageInfo_Rollapp.DiscardUnknown(m) +} + +var xxx_messageInfo_Rollapp proto.InternalMessageInfo + +func (m *Rollapp) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *Rollapp) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *Rollapp) GetVersion() uint64 { + if m != nil { + return m.Version + } + return 0 +} + +func (m *Rollapp) GetMaxSequencers() uint64 { + if m != nil { + return m.MaxSequencers + } + return 0 +} + +func (m *Rollapp) GetPermissionedAddresses() []string { + if m != nil { + return m.PermissionedAddresses + } + return nil +} + +func (m *Rollapp) GetTokenMetadata() []*TokenMetadata { + if m != nil { + return m.TokenMetadata + } + return nil +} + +func (m *Rollapp) GetGenesisState() RollappGenesisState { + if m != nil { + return m.GenesisState + } + return RollappGenesisState{} +} + +func (m *Rollapp) GetChannelId() string { + if m != nil { + return m.ChannelId + } + return "" +} + +func (m *Rollapp) GetFrozen() bool { + if m != nil { + return m.Frozen + } + return false +} + +// Rollapp summary is a compact representation of Rollapp +type RollappSummary struct { + // The unique identifier of the rollapp chain. + // The rollapp_id follows the same standard as cosmos chain_id. + RollappId string `protobuf:"bytes,1,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` + // Defines the index of the last rollapp UpdateState. + LatestStateIndex *StateInfoIndex `protobuf:"bytes,2,opt,name=latest_state_index,json=latestStateIndex,proto3" json:"latest_state_index,omitempty"` + // Defines the index of the last rollapp UpdateState that was finalized. + LatestFinalizedStateIndex *StateInfoIndex `protobuf:"bytes,3,opt,name=latest_finalized_state_index,json=latestFinalizedStateIndex,proto3" json:"latest_finalized_state_index,omitempty"` +} + +func (m *RollappSummary) Reset() { *m = RollappSummary{} } +func (m *RollappSummary) String() string { return proto.CompactTextString(m) } +func (*RollappSummary) ProtoMessage() {} +func (*RollappSummary) Descriptor() ([]byte, []int) { + return fileDescriptor_aecaa292d97582fe, []int{3} +} +func (m *RollappSummary) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RollappSummary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RollappSummary.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 *RollappSummary) XXX_Merge(src proto.Message) { + xxx_messageInfo_RollappSummary.Merge(m, src) +} +func (m *RollappSummary) XXX_Size() int { + return m.Size() +} +func (m *RollappSummary) XXX_DiscardUnknown() { + xxx_messageInfo_RollappSummary.DiscardUnknown(m) +} + +var xxx_messageInfo_RollappSummary proto.InternalMessageInfo + +func (m *RollappSummary) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *RollappSummary) GetLatestStateIndex() *StateInfoIndex { + if m != nil { + return m.LatestStateIndex + } + return nil +} + +func (m *RollappSummary) GetLatestFinalizedStateIndex() *StateInfoIndex { + if m != nil { + return m.LatestFinalizedStateIndex + } + return nil +} + +func init() { + proto.RegisterType((*GenesisAccount)(nil), "nucleic.rollapp.GenesisAccount") + proto.RegisterType((*RollappGenesisState)(nil), "nucleic.rollapp.RollappGenesisState") + proto.RegisterType((*Rollapp)(nil), "nucleic.rollapp.Rollapp") + proto.RegisterType((*RollappSummary)(nil), "nucleic.rollapp.RollappSummary") +} + +func init() { proto.RegisterFile("nucleic/rollapp/rollapp.proto", fileDescriptor_aecaa292d97582fe) } + +var fileDescriptor_aecaa292d97582fe = []byte{ + // 587 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x41, 0x6f, 0xd3, 0x4c, + 0x10, 0x8d, 0xbf, 0xf4, 0x4b, 0x9b, 0x2d, 0x49, 0xa3, 0x05, 0x2a, 0x37, 0x22, 0xae, 0x15, 0x81, + 0xe4, 0x0b, 0xb6, 0x1a, 0x84, 0x38, 0xb7, 0xa8, 0xa0, 0x20, 0x2a, 0x24, 0x87, 0x13, 0x17, 0xb3, + 0xb1, 0x27, 0xee, 0x2a, 0xf6, 0x6e, 0xf0, 0x6e, 0x42, 0xda, 0x7f, 0x80, 0xb8, 0xf0, 0xb3, 0x7a, + 0xec, 0x91, 0x13, 0xaa, 0x92, 0x3f, 0x82, 0x6c, 0xef, 0x96, 0x24, 0xad, 0x04, 0x27, 0xfb, 0xcd, + 0xcc, 0xbe, 0x79, 0x3b, 0x6f, 0x16, 0x75, 0xd8, 0x34, 0x4c, 0x80, 0x86, 0x5e, 0xc6, 0x93, 0x84, + 0x4c, 0x26, 0xfa, 0xeb, 0x4e, 0x32, 0x2e, 0x39, 0xde, 0x53, 0x69, 0x57, 0x85, 0xdb, 0x8f, 0x62, + 0x1e, 0xf3, 0x22, 0xe7, 0xe5, 0x7f, 0x65, 0x59, 0xdb, 0x0a, 0xb9, 0x48, 0xb9, 0xf0, 0x86, 0x44, + 0x80, 0x37, 0x3b, 0x1a, 0x82, 0x24, 0x47, 0x5e, 0xc8, 0x29, 0x53, 0x79, 0x7b, 0xb3, 0x8b, 0x90, + 0x44, 0x42, 0x40, 0xd9, 0x48, 0x33, 0xb4, 0x37, 0x2b, 0x86, 0x84, 0x8d, 0xcb, 0x5c, 0x37, 0x44, + 0xcd, 0xb7, 0xc0, 0x40, 0x50, 0x71, 0x1c, 0x86, 0x7c, 0xca, 0x24, 0x7e, 0x85, 0x6a, 0x24, 0xcd, + 0xff, 0x4c, 0xc3, 0x36, 0x9c, 0xdd, 0xde, 0x81, 0x5b, 0x0a, 0x70, 0x73, 0x01, 0xae, 0x12, 0xe0, + 0xbe, 0xe6, 0x94, 0x9d, 0x6c, 0x5d, 0xfd, 0x3a, 0xac, 0xf8, 0xaa, 0x1c, 0x9b, 0x68, 0x9b, 0x44, + 0x51, 0x06, 0x42, 0x98, 0xff, 0xd9, 0x86, 0x53, 0xf7, 0x35, 0xec, 0x7e, 0x37, 0xd0, 0x43, 0xbf, + 0xec, 0xad, 0x9a, 0x0d, 0x72, 0x8d, 0xf8, 0x1d, 0x6a, 0xc5, 0x25, 0x0e, 0x48, 0xd9, 0x5d, 0x98, + 0x86, 0x5d, 0x75, 0x76, 0x7b, 0x87, 0xee, 0xc6, 0x70, 0xdc, 0x75, 0x95, 0xfe, 0x5e, 0xbc, 0x86, + 0x05, 0x76, 0x50, 0x8b, 0x8a, 0x40, 0xd3, 0xc1, 0x0c, 0x98, 0x2c, 0x64, 0xec, 0xf8, 0x4d, 0x2a, + 0xd4, 0xe1, 0xd3, 0x3c, 0xda, 0xfd, 0x56, 0x45, 0xdb, 0x4a, 0x0d, 0xee, 0x20, 0xa4, 0x1a, 0x04, + 0x34, 0x2a, 0x2e, 0x5c, 0xf7, 0xeb, 0x2a, 0xd2, 0x8f, 0xf2, 0x2b, 0x85, 0x19, 0x10, 0xc9, 0x33, + 0x7d, 0x25, 0x05, 0xf3, 0xcc, 0x0c, 0x32, 0x41, 0x39, 0x33, 0xab, 0xb6, 0xe1, 0x6c, 0xf9, 0x1a, + 0xe2, 0x67, 0xa8, 0x99, 0x92, 0x79, 0x20, 0xe0, 0xcb, 0x14, 0x58, 0x08, 0x99, 0x30, 0xb7, 0x8a, + 0x82, 0x46, 0x4a, 0xe6, 0x83, 0xdb, 0x20, 0x7e, 0x89, 0xf6, 0x27, 0x90, 0xa5, 0x54, 0xe4, 0x87, + 0x20, 0x0a, 0xd4, 0xac, 0x40, 0x98, 0xff, 0xdb, 0x55, 0xa7, 0xee, 0x3f, 0x5e, 0xcd, 0x1e, 0xeb, + 0x24, 0x3e, 0x45, 0x4d, 0xc9, 0xc7, 0xc0, 0x82, 0x14, 0x24, 0x89, 0x88, 0x24, 0x66, 0xad, 0x18, + 0x98, 0x75, 0x67, 0x60, 0x1f, 0xf3, 0xb2, 0x33, 0x55, 0xe5, 0x37, 0xe4, 0x2a, 0xc4, 0x1f, 0x50, + 0x43, 0x8f, 0xaa, 0x58, 0x17, 0x73, 0xbb, 0xf0, 0xfa, 0xe9, 0x1d, 0x96, 0x7b, 0x6c, 0x53, 0xb6, + 0x3f, 0x88, 0x57, 0xad, 0xec, 0x20, 0x14, 0x9e, 0x13, 0xc6, 0x20, 0xc9, 0x07, 0xb9, 0x53, 0x0e, + 0x52, 0x45, 0xfa, 0x11, 0xde, 0x47, 0xb5, 0x51, 0xc6, 0x2f, 0x81, 0x99, 0xf5, 0xc2, 0x13, 0x85, + 0xba, 0x37, 0x06, 0x6a, 0xaa, 0x16, 0x83, 0x69, 0x9a, 0x92, 0xec, 0xe2, 0x6f, 0x96, 0x9c, 0x21, + 0x9c, 0x10, 0x09, 0x42, 0x06, 0x7a, 0xcf, 0x23, 0x98, 0x17, 0xee, 0xdc, 0xb7, 0x35, 0x85, 0xb8, + 0x3e, 0x1b, 0xf1, 0x7e, 0x5e, 0xe6, 0xb7, 0xca, 0xa3, 0x2a, 0x1a, 0xc1, 0x1c, 0x7f, 0x46, 0x4f, + 0x14, 0xdd, 0x88, 0x32, 0x92, 0xd0, 0x4b, 0x88, 0xd6, 0x88, 0xab, 0xff, 0x46, 0x7c, 0x50, 0x92, + 0xbc, 0xd1, 0x1c, 0x7f, 0x3a, 0x9c, 0xbc, 0xbf, 0x5a, 0x58, 0xc6, 0xf5, 0xc2, 0x32, 0x6e, 0x16, + 0x96, 0xf1, 0x63, 0x69, 0x55, 0xae, 0x97, 0x56, 0xe5, 0xe7, 0xd2, 0xaa, 0x7c, 0xea, 0xc5, 0x54, + 0x9e, 0x4f, 0x87, 0x6e, 0xc8, 0x53, 0x4f, 0xf1, 0x3f, 0x67, 0x20, 0xbf, 0xf2, 0x6c, 0xac, 0xb1, + 0x37, 0xbf, 0x7d, 0xb4, 0xf2, 0x62, 0x02, 0x62, 0x58, 0x2b, 0x9e, 0xed, 0x8b, 0xdf, 0x01, 0x00, + 0x00, 0xff, 0xff, 0x05, 0x4e, 0xba, 0x76, 0x5c, 0x04, 0x00, 0x00, +} + +func (m *GenesisAccount) 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 *GenesisAccount) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRollapp(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *RollappGenesisState) 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 *RollappGenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RollappGenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.IsGenesisEvent { + i-- + if m.IsGenesisEvent { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.GenesisAccounts) > 0 { + for iNdEx := len(m.GenesisAccounts) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.GenesisAccounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRollapp(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Rollapp) 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 *Rollapp) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Rollapp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Frozen { + i-- + if m.Frozen { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x48 + } + if len(m.ChannelId) > 0 { + i -= len(m.ChannelId) + copy(dAtA[i:], m.ChannelId) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.ChannelId))) + i-- + dAtA[i] = 0x42 + } + { + size, err := m.GenesisState.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRollapp(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + if len(m.TokenMetadata) > 0 { + for iNdEx := len(m.TokenMetadata) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TokenMetadata[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRollapp(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if len(m.PermissionedAddresses) > 0 { + for iNdEx := len(m.PermissionedAddresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.PermissionedAddresses[iNdEx]) + copy(dAtA[i:], m.PermissionedAddresses[iNdEx]) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.PermissionedAddresses[iNdEx]))) + i-- + dAtA[i] = 0x2a + } + } + if m.MaxSequencers != 0 { + i = encodeVarintRollapp(dAtA, i, uint64(m.MaxSequencers)) + i-- + dAtA[i] = 0x20 + } + if m.Version != 0 { + i = encodeVarintRollapp(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x18 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0x12 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RollappSummary) 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 *RollappSummary) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RollappSummary) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LatestFinalizedStateIndex != nil { + { + size, err := m.LatestFinalizedStateIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRollapp(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.LatestStateIndex != nil { + { + size, err := m.LatestStateIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRollapp(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintRollapp(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintRollapp(dAtA []byte, offset int, v uint64) int { + offset -= sovRollapp(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisAccount) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovRollapp(uint64(l)) + l = len(m.Address) + if l > 0 { + n += 1 + l + sovRollapp(uint64(l)) + } + return n +} + +func (m *RollappGenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.GenesisAccounts) > 0 { + for _, e := range m.GenesisAccounts { + l = e.Size() + n += 1 + l + sovRollapp(uint64(l)) + } + } + if m.IsGenesisEvent { + n += 2 + } + return n +} + +func (m *Rollapp) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovRollapp(uint64(l)) + } + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovRollapp(uint64(l)) + } + if m.Version != 0 { + n += 1 + sovRollapp(uint64(m.Version)) + } + if m.MaxSequencers != 0 { + n += 1 + sovRollapp(uint64(m.MaxSequencers)) + } + if len(m.PermissionedAddresses) > 0 { + for _, s := range m.PermissionedAddresses { + l = len(s) + n += 1 + l + sovRollapp(uint64(l)) + } + } + if len(m.TokenMetadata) > 0 { + for _, e := range m.TokenMetadata { + l = e.Size() + n += 1 + l + sovRollapp(uint64(l)) + } + } + l = m.GenesisState.Size() + n += 1 + l + sovRollapp(uint64(l)) + l = len(m.ChannelId) + if l > 0 { + n += 1 + l + sovRollapp(uint64(l)) + } + if m.Frozen { + n += 2 + } + return n +} + +func (m *RollappSummary) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovRollapp(uint64(l)) + } + if m.LatestStateIndex != nil { + l = m.LatestStateIndex.Size() + n += 1 + l + sovRollapp(uint64(l)) + } + if m.LatestFinalizedStateIndex != nil { + l = m.LatestFinalizedStateIndex.Size() + n += 1 + l + sovRollapp(uint64(l)) + } + return n +} + +func sovRollapp(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozRollapp(x uint64) (n int) { + return sovRollapp(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisAccount) 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 ErrIntOverflowRollapp + } + 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: GenesisAccount: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisAccount: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRollapp + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + 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 ErrInvalidLengthRollapp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRollapp(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRollapp + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RollappGenesisState) 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 ErrIntOverflowRollapp + } + 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: RollappGenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RollappGenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GenesisAccounts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRollapp + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GenesisAccounts = append(m.GenesisAccounts, &GenesisAccount{}) + if err := m.GenesisAccounts[len(m.GenesisAccounts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsGenesisEvent", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsGenesisEvent = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipRollapp(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRollapp + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Rollapp) 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 ErrIntOverflowRollapp + } + 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: Rollapp: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Rollapp: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + 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 ErrInvalidLengthRollapp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + 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 ErrInvalidLengthRollapp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxSequencers", wireType) + } + m.MaxSequencers = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxSequencers |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PermissionedAddresses", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + 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 ErrInvalidLengthRollapp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PermissionedAddresses = append(m.PermissionedAddresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenMetadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRollapp + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenMetadata = append(m.TokenMetadata, &TokenMetadata{}) + if err := m.TokenMetadata[len(m.TokenMetadata)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GenesisState", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRollapp + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.GenesisState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + 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 ErrInvalidLengthRollapp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Frozen", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Frozen = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipRollapp(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRollapp + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RollappSummary) 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 ErrIntOverflowRollapp + } + 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: RollappSummary: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RollappSummary: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + 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 ErrInvalidLengthRollapp + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestStateIndex", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRollapp + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LatestStateIndex == nil { + m.LatestStateIndex = &StateInfoIndex{} + } + if err := m.LatestStateIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestFinalizedStateIndex", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRollapp + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRollapp + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRollapp + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LatestFinalizedStateIndex == nil { + m.LatestFinalizedStateIndex = &StateInfoIndex{} + } + if err := m.LatestFinalizedStateIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRollapp(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRollapp + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRollapp(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, ErrIntOverflowRollapp + } + 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, ErrIntOverflowRollapp + } + 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, ErrIntOverflowRollapp + } + 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, ErrInvalidLengthRollapp + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRollapp + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthRollapp + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthRollapp = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRollapp = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRollapp = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/rollapp/types/state_info.go b/x/rollapp/types/state_info.go new file mode 100644 index 00000000..23e1f07f --- /dev/null +++ b/x/rollapp/types/state_info.go @@ -0,0 +1,57 @@ +package types + +import ( + "strconv" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func NewStateInfo( + rollappId string, + newIndex uint64, + creator string, + startHeight, + numBlocks uint64, + daPath string, + version uint64, + height uint64, + blockDescs BlockDescriptors, +) *StateInfo { + stateInfoIndex := StateInfoIndex{RollappId: rollappId, Index: newIndex} + status := Status_PENDING + return &StateInfo{ + StateInfoIndex: stateInfoIndex, + Sequencer: creator, + StartHeight: startHeight, + NumBlocks: numBlocks, + DaPath: daPath, + Version: version, + CreationHeight: height, + Status: status, + BlockDescs: blockDescs, + } +} + +func (s *StateInfo) Finalize() { + s.Status = Status_FINALIZED +} + +func (s *StateInfo) GetIndex() StateInfoIndex { + return s.StateInfoIndex +} + +func (s *StateInfo) GetLatestHeight() uint64 { + return s.StartHeight + s.NumBlocks - 1 +} + +func (s *StateInfo) GetEvents() []sdk.Attribute { + eventAttributes := []sdk.Attribute{ + sdk.NewAttribute(AttributeKeyRollappId, s.StateInfoIndex.RollappId), + sdk.NewAttribute(AttributeKeyStateInfoIndex, strconv.FormatUint(s.StateInfoIndex.Index, 10)), + sdk.NewAttribute(AttributeKeyStartHeight, strconv.FormatUint(s.StartHeight, 10)), + sdk.NewAttribute(AttributeKeyNumBlocks, strconv.FormatUint(s.NumBlocks, 10)), + sdk.NewAttribute(AttributeKeyDAPath, s.DaPath), + sdk.NewAttribute(AttributeKeyStatus, s.Status.String()), + } + return eventAttributes +} diff --git a/x/rollapp/types/state_info.pb.go b/x/rollapp/types/state_info.pb.go new file mode 100644 index 00000000..f7ea78b2 --- /dev/null +++ b/x/rollapp/types/state_info.pb.go @@ -0,0 +1,1400 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollapp/state_info.proto + +package types + +import ( + fmt "fmt" + _ "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 + +// Status of state +type Status int32 + +const ( + Status_PENDING Status = 0 + Status_FINALIZED Status = 1 + Status_REVERTED Status = 3 +) + +var Status_name = map[int32]string{ + 0: "PENDING", + 1: "FINALIZED", + 3: "REVERTED", +} + +var Status_value = map[string]int32{ + "PENDING": 0, + "FINALIZED": 1, + "REVERTED": 3, +} + +func (x Status) String() string { + return proto.EnumName(Status_name, int32(x)) +} + +func (Status) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_759345ac0f400d2c, []int{0} +} + +// StateInfoIndex is the data used for indexing and retrieving a StateInfo +// it updated and saved with every UpdateState in StateInfo. +// We use the this structure also for: +// 1. LatestStateInfoIndex which defines the rollapps' current (latest) index of +// the last UpdateState +// 2. LatestFinalizedStateIndex which defines the rollapps' current (latest) +// index of the latest StateInfo that was finalized +type StateInfoIndex struct { + // rollapp_id is the rollapp that the sequencer belongs to and asking to + // update it used to identify the what rollapp a StateInfo belongs The + // rollapp_id follows the same standard as cosmos chain_id + RollappId string `protobuf:"bytes,1,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` + // index is a sequential increasing number, updating on each + // state update used for indexing to a specific state info, the first index is + // 1 + Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` +} + +func (m *StateInfoIndex) Reset() { *m = StateInfoIndex{} } +func (m *StateInfoIndex) String() string { return proto.CompactTextString(m) } +func (*StateInfoIndex) ProtoMessage() {} +func (*StateInfoIndex) Descriptor() ([]byte, []int) { + return fileDescriptor_759345ac0f400d2c, []int{0} +} +func (m *StateInfoIndex) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StateInfoIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StateInfoIndex.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 *StateInfoIndex) XXX_Merge(src proto.Message) { + xxx_messageInfo_StateInfoIndex.Merge(m, src) +} +func (m *StateInfoIndex) XXX_Size() int { + return m.Size() +} +func (m *StateInfoIndex) XXX_DiscardUnknown() { + xxx_messageInfo_StateInfoIndex.DiscardUnknown(m) +} + +var xxx_messageInfo_StateInfoIndex proto.InternalMessageInfo + +func (m *StateInfoIndex) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *StateInfoIndex) GetIndex() uint64 { + if m != nil { + return m.Index + } + return 0 +} + +// StateInfo defines a rollapps' state. +type StateInfo struct { + // state_info_index defines what rollapp the state belongs to + // and in which index it can be referenced + StateInfoIndex StateInfoIndex `protobuf:"bytes,1,opt,name=state_info_index,json=stateInfoIndex,proto3" json:"state_info_index"` + // sequencer is the bech32-encoded address of the sequencer sent the update + Sequencer string `protobuf:"bytes,2,opt,name=sequencer,proto3" json:"sequencer,omitempty"` + // start_height is the block height of the first block in the batch + StartHeight uint64 `protobuf:"varint,3,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` + // num_blocks is the number of blocks included in this batch update + NumBlocks uint64 `protobuf:"varint,4,opt,name=num_blocks,json=numBlocks,proto3" json:"num_blocks,omitempty"` + // da_path is the description of the location on the DA layer + DaPath string `protobuf:"bytes,5,opt,name=da_path,json=daPath,proto3" json:"da_path,omitempty"` + // version is the version of the rollapp + Version uint64 `protobuf:"varint,6,opt,name=version,proto3" json:"version,omitempty"` + // creation_height is the height at which the UpdateState took place + CreationHeight uint64 `protobuf:"varint,7,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"` + // status is the status of the state update + Status Status `protobuf:"varint,8,opt,name=status,proto3,enum=nucleic.rollapp.Status" json:"status,omitempty"` + // bds is a list of block description objects (one per block) + // the list must be ordered by height, starting from start_height to + // start_height+num_blocks-1 + BlockDescs BlockDescriptors `protobuf:"bytes,9,opt,name=block_descs,json=blockDescs,proto3" json:"block_descs"` +} + +func (m *StateInfo) Reset() { *m = StateInfo{} } +func (m *StateInfo) String() string { return proto.CompactTextString(m) } +func (*StateInfo) ProtoMessage() {} +func (*StateInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_759345ac0f400d2c, []int{1} +} +func (m *StateInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StateInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StateInfo.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 *StateInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_StateInfo.Merge(m, src) +} +func (m *StateInfo) XXX_Size() int { + return m.Size() +} +func (m *StateInfo) XXX_DiscardUnknown() { + xxx_messageInfo_StateInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_StateInfo proto.InternalMessageInfo + +func (m *StateInfo) GetStateInfoIndex() StateInfoIndex { + if m != nil { + return m.StateInfoIndex + } + return StateInfoIndex{} +} + +func (m *StateInfo) GetSequencer() string { + if m != nil { + return m.Sequencer + } + return "" +} + +func (m *StateInfo) GetStartHeight() uint64 { + if m != nil { + return m.StartHeight + } + return 0 +} + +func (m *StateInfo) GetNumBlocks() uint64 { + if m != nil { + return m.NumBlocks + } + return 0 +} + +func (m *StateInfo) GetDaPath() string { + if m != nil { + return m.DaPath + } + return "" +} + +func (m *StateInfo) GetVersion() uint64 { + if m != nil { + return m.Version + } + return 0 +} + +func (m *StateInfo) GetCreationHeight() uint64 { + if m != nil { + return m.CreationHeight + } + return 0 +} + +func (m *StateInfo) GetStatus() Status { + if m != nil { + return m.Status + } + return Status_PENDING +} + +func (m *StateInfo) GetBlockDescs() BlockDescriptors { + if m != nil { + return m.BlockDescs + } + return BlockDescriptors{} +} + +// StateInfoSummary is a compact representation of StateInfo +type StateInfoSummary struct { + // state_info_index defines what rollapp the state belongs to + // and in which index it can be referenced + StateInfoIndex StateInfoIndex `protobuf:"bytes,1,opt,name=state_info_index,json=stateInfoIndex,proto3" json:"state_info_index"` + // status is the status of the state update + Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=nucleic.rollapp.Status" json:"status,omitempty"` + // creation_height is the height at which the UpdateState took place + CreationHeight uint64 `protobuf:"varint,3,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"` +} + +func (m *StateInfoSummary) Reset() { *m = StateInfoSummary{} } +func (m *StateInfoSummary) String() string { return proto.CompactTextString(m) } +func (*StateInfoSummary) ProtoMessage() {} +func (*StateInfoSummary) Descriptor() ([]byte, []int) { + return fileDescriptor_759345ac0f400d2c, []int{2} +} +func (m *StateInfoSummary) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StateInfoSummary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StateInfoSummary.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 *StateInfoSummary) XXX_Merge(src proto.Message) { + xxx_messageInfo_StateInfoSummary.Merge(m, src) +} +func (m *StateInfoSummary) XXX_Size() int { + return m.Size() +} +func (m *StateInfoSummary) XXX_DiscardUnknown() { + xxx_messageInfo_StateInfoSummary.DiscardUnknown(m) +} + +var xxx_messageInfo_StateInfoSummary proto.InternalMessageInfo + +func (m *StateInfoSummary) GetStateInfoIndex() StateInfoIndex { + if m != nil { + return m.StateInfoIndex + } + return StateInfoIndex{} +} + +func (m *StateInfoSummary) GetStatus() Status { + if m != nil { + return m.Status + } + return Status_PENDING +} + +func (m *StateInfoSummary) GetCreationHeight() uint64 { + if m != nil { + return m.CreationHeight + } + return 0 +} + +// BlockHeightToFinalizationQueue defines a map from block height to list of +// states to finalized +type BlockHeightToFinalizationQueue struct { + // creation_height is the block height that the state should be finalized + CreationHeight uint64 `protobuf:"varint,1,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"` + // finalization_queue is a list of states that are waiting to be finalized + // when the block height becomes creation_height + FinalizationQueue []StateInfoIndex `protobuf:"bytes,2,rep,name=finalization_queue,json=finalizationQueue,proto3" json:"finalization_queue"` +} + +func (m *BlockHeightToFinalizationQueue) Reset() { *m = BlockHeightToFinalizationQueue{} } +func (m *BlockHeightToFinalizationQueue) String() string { return proto.CompactTextString(m) } +func (*BlockHeightToFinalizationQueue) ProtoMessage() {} +func (*BlockHeightToFinalizationQueue) Descriptor() ([]byte, []int) { + return fileDescriptor_759345ac0f400d2c, []int{3} +} +func (m *BlockHeightToFinalizationQueue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BlockHeightToFinalizationQueue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BlockHeightToFinalizationQueue.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 *BlockHeightToFinalizationQueue) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockHeightToFinalizationQueue.Merge(m, src) +} +func (m *BlockHeightToFinalizationQueue) XXX_Size() int { + return m.Size() +} +func (m *BlockHeightToFinalizationQueue) XXX_DiscardUnknown() { + xxx_messageInfo_BlockHeightToFinalizationQueue.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockHeightToFinalizationQueue proto.InternalMessageInfo + +func (m *BlockHeightToFinalizationQueue) GetCreationHeight() uint64 { + if m != nil { + return m.CreationHeight + } + return 0 +} + +func (m *BlockHeightToFinalizationQueue) GetFinalizationQueue() []StateInfoIndex { + if m != nil { + return m.FinalizationQueue + } + return nil +} + +func init() { + proto.RegisterEnum("nucleic.rollapp.Status", Status_name, Status_value) + proto.RegisterType((*StateInfoIndex)(nil), "nucleic.rollapp.StateInfoIndex") + proto.RegisterType((*StateInfo)(nil), "nucleic.rollapp.StateInfo") + proto.RegisterType((*StateInfoSummary)(nil), "nucleic.rollapp.StateInfoSummary") + proto.RegisterType((*BlockHeightToFinalizationQueue)(nil), "nucleic.rollapp.BlockHeightToFinalizationQueue") +} + +func init() { proto.RegisterFile("nucleic/rollapp/state_info.proto", fileDescriptor_759345ac0f400d2c) } + +var fileDescriptor_759345ac0f400d2c = []byte{ + // 539 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0xc1, 0x6e, 0xda, 0x40, + 0x10, 0x65, 0x03, 0x81, 0x78, 0x48, 0x09, 0x5d, 0x45, 0x8a, 0x15, 0xb5, 0x0e, 0xe1, 0xd0, 0xa2, + 0x4a, 0xc5, 0x12, 0xfd, 0x82, 0x22, 0x9c, 0xc6, 0x52, 0x44, 0x53, 0x07, 0xf5, 0x90, 0x8b, 0x65, + 0xec, 0x05, 0x56, 0x81, 0x5d, 0xc7, 0xbb, 0x6e, 0x93, 0x7e, 0x45, 0xa5, 0x7e, 0x40, 0xbf, 0xa4, + 0xf7, 0x1c, 0x73, 0xec, 0xa9, 0xaa, 0xe0, 0x47, 0x2a, 0xaf, 0x0d, 0x34, 0xd4, 0x87, 0x1c, 0x7a, + 0xf3, 0x3c, 0xbf, 0x99, 0x79, 0xef, 0x8d, 0x16, 0x1a, 0x2c, 0xf6, 0xa7, 0x84, 0xfa, 0x66, 0xc4, + 0xa7, 0x53, 0x2f, 0x0c, 0x4d, 0x21, 0x3d, 0x49, 0x5c, 0xca, 0x46, 0xbc, 0x1d, 0x46, 0x5c, 0x72, + 0xbc, 0x97, 0x31, 0xda, 0x19, 0xe3, 0x70, 0x7f, 0xcc, 0xc7, 0x5c, 0xfd, 0x33, 0x93, 0xaf, 0x94, + 0x76, 0xf8, 0x62, 0x73, 0xd0, 0x70, 0xca, 0xfd, 0x2b, 0x37, 0x20, 0xc2, 0x8f, 0x68, 0x28, 0x79, + 0x94, 0xf2, 0x9a, 0x16, 0xd4, 0x2e, 0x92, 0x15, 0x36, 0x1b, 0x71, 0x9b, 0x05, 0xe4, 0x06, 0x3f, + 0x07, 0xc8, 0x7a, 0x5c, 0x1a, 0xe8, 0xa8, 0x81, 0x5a, 0x9a, 0xa3, 0x65, 0x88, 0x1d, 0xe0, 0x7d, + 0xd8, 0xa6, 0x09, 0x4f, 0xdf, 0x6a, 0xa0, 0x56, 0xc9, 0x49, 0x8b, 0xe6, 0xb7, 0x22, 0x68, 0xab, + 0x39, 0xf8, 0x3d, 0xd4, 0xd7, 0xba, 0xdd, 0x94, 0x9e, 0x0c, 0xaa, 0x76, 0x8e, 0xda, 0x1b, 0xf2, + 0xdb, 0x0f, 0xb7, 0x77, 0x4b, 0x77, 0xbf, 0x8e, 0x0a, 0x4e, 0x4d, 0x3c, 0xd4, 0xf4, 0x0c, 0x34, + 0x41, 0xae, 0x63, 0xc2, 0x7c, 0x12, 0xa9, 0xc5, 0x9a, 0xb3, 0x06, 0xf0, 0x31, 0xec, 0x0a, 0xe9, + 0x45, 0xd2, 0x9d, 0x10, 0x3a, 0x9e, 0x48, 0xbd, 0xa8, 0x94, 0x55, 0x15, 0x76, 0xaa, 0xa0, 0xc4, + 0x14, 0x8b, 0x67, 0xae, 0x0a, 0x41, 0xe8, 0x25, 0x45, 0xd0, 0x58, 0x3c, 0xeb, 0x2a, 0x00, 0x1f, + 0x40, 0x25, 0xf0, 0xdc, 0xd0, 0x93, 0x13, 0x7d, 0x5b, 0x4d, 0x2f, 0x07, 0xde, 0xb9, 0x27, 0x27, + 0x58, 0x87, 0xca, 0x27, 0x12, 0x09, 0xca, 0x99, 0x5e, 0x56, 0x4d, 0xcb, 0x12, 0xbf, 0x84, 0x3d, + 0x3f, 0x22, 0x9e, 0xa4, 0x9c, 0x2d, 0xf7, 0x56, 0x14, 0xa3, 0xb6, 0x84, 0xb3, 0xd5, 0x26, 0x94, + 0x13, 0x37, 0xb1, 0xd0, 0x77, 0x1a, 0xa8, 0x55, 0xeb, 0x1c, 0xe4, 0x46, 0x10, 0x0b, 0x27, 0xa3, + 0xe1, 0x53, 0xa8, 0xae, 0x8f, 0x25, 0x74, 0x4d, 0x05, 0x77, 0xfc, 0x4f, 0x97, 0x92, 0xde, 0x5b, + 0xdd, 0x53, 0x64, 0xd1, 0xc1, 0x70, 0x89, 0x8b, 0xe6, 0x0f, 0x04, 0xf5, 0x55, 0xbe, 0x17, 0xf1, + 0x6c, 0xe6, 0x45, 0xb7, 0xff, 0xff, 0x38, 0x6b, 0x83, 0x5b, 0x8f, 0x33, 0x98, 0x13, 0x5d, 0x31, + 0x2f, 0xba, 0xe6, 0x77, 0x04, 0x86, 0xb2, 0x99, 0xd6, 0x03, 0x7e, 0x42, 0x99, 0x37, 0xa5, 0x5f, + 0x14, 0xe7, 0x43, 0x4c, 0x62, 0x92, 0x37, 0x0b, 0xe5, 0x9e, 0x61, 0x00, 0x78, 0xf4, 0x57, 0xb7, + 0x7b, 0x9d, 0xb4, 0xeb, 0x5b, 0x8d, 0xe2, 0xe3, 0x8d, 0x3f, 0x1d, 0x6d, 0xae, 0x7f, 0xd5, 0x81, + 0x72, 0x6a, 0x0e, 0x57, 0xa1, 0x72, 0x6e, 0xf5, 0x7b, 0x76, 0xff, 0x5d, 0xbd, 0x80, 0x9f, 0x80, + 0x76, 0x62, 0xf7, 0xdf, 0x9e, 0xd9, 0x97, 0x56, 0xaf, 0x8e, 0xf0, 0x2e, 0xec, 0x38, 0xd6, 0x47, + 0xcb, 0x19, 0x58, 0xbd, 0x7a, 0xb1, 0x7b, 0x76, 0x37, 0x37, 0xd0, 0xfd, 0xdc, 0x40, 0xbf, 0xe7, + 0x06, 0xfa, 0xba, 0x30, 0x0a, 0xf7, 0x0b, 0xa3, 0xf0, 0x73, 0x61, 0x14, 0x2e, 0x3b, 0x63, 0x2a, + 0x27, 0xf1, 0xb0, 0xed, 0xf3, 0x99, 0x99, 0x29, 0x7a, 0xcd, 0x88, 0xfc, 0xcc, 0xa3, 0xab, 0x65, + 0x6d, 0xde, 0xac, 0x5e, 0xb4, 0xbc, 0x0d, 0x89, 0x18, 0x96, 0xd5, 0x3b, 0x7e, 0xf3, 0x27, 0x00, + 0x00, 0xff, 0xff, 0x71, 0x92, 0x75, 0xc3, 0x3a, 0x04, 0x00, 0x00, +} + +func (m *StateInfoIndex) 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 *StateInfoIndex) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StateInfoIndex) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Index != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x10 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintStateInfo(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *StateInfo) 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 *StateInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StateInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.BlockDescs.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStateInfo(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + if m.Status != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x40 + } + if m.CreationHeight != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.CreationHeight)) + i-- + dAtA[i] = 0x38 + } + if m.Version != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x30 + } + if len(m.DaPath) > 0 { + i -= len(m.DaPath) + copy(dAtA[i:], m.DaPath) + i = encodeVarintStateInfo(dAtA, i, uint64(len(m.DaPath))) + i-- + dAtA[i] = 0x2a + } + if m.NumBlocks != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.NumBlocks)) + i-- + dAtA[i] = 0x20 + } + if m.StartHeight != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.StartHeight)) + i-- + dAtA[i] = 0x18 + } + if len(m.Sequencer) > 0 { + i -= len(m.Sequencer) + copy(dAtA[i:], m.Sequencer) + i = encodeVarintStateInfo(dAtA, i, uint64(len(m.Sequencer))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.StateInfoIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStateInfo(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *StateInfoSummary) 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 *StateInfoSummary) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StateInfoSummary) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CreationHeight != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.CreationHeight)) + i-- + dAtA[i] = 0x18 + } + if m.Status != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x10 + } + { + size, err := m.StateInfoIndex.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStateInfo(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *BlockHeightToFinalizationQueue) 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 *BlockHeightToFinalizationQueue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockHeightToFinalizationQueue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FinalizationQueue) > 0 { + for iNdEx := len(m.FinalizationQueue) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FinalizationQueue[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStateInfo(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.CreationHeight != 0 { + i = encodeVarintStateInfo(dAtA, i, uint64(m.CreationHeight)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintStateInfo(dAtA []byte, offset int, v uint64) int { + offset -= sovStateInfo(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *StateInfoIndex) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovStateInfo(uint64(l)) + } + if m.Index != 0 { + n += 1 + sovStateInfo(uint64(m.Index)) + } + return n +} + +func (m *StateInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.StateInfoIndex.Size() + n += 1 + l + sovStateInfo(uint64(l)) + l = len(m.Sequencer) + if l > 0 { + n += 1 + l + sovStateInfo(uint64(l)) + } + if m.StartHeight != 0 { + n += 1 + sovStateInfo(uint64(m.StartHeight)) + } + if m.NumBlocks != 0 { + n += 1 + sovStateInfo(uint64(m.NumBlocks)) + } + l = len(m.DaPath) + if l > 0 { + n += 1 + l + sovStateInfo(uint64(l)) + } + if m.Version != 0 { + n += 1 + sovStateInfo(uint64(m.Version)) + } + if m.CreationHeight != 0 { + n += 1 + sovStateInfo(uint64(m.CreationHeight)) + } + if m.Status != 0 { + n += 1 + sovStateInfo(uint64(m.Status)) + } + l = m.BlockDescs.Size() + n += 1 + l + sovStateInfo(uint64(l)) + return n +} + +func (m *StateInfoSummary) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.StateInfoIndex.Size() + n += 1 + l + sovStateInfo(uint64(l)) + if m.Status != 0 { + n += 1 + sovStateInfo(uint64(m.Status)) + } + if m.CreationHeight != 0 { + n += 1 + sovStateInfo(uint64(m.CreationHeight)) + } + return n +} + +func (m *BlockHeightToFinalizationQueue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CreationHeight != 0 { + n += 1 + sovStateInfo(uint64(m.CreationHeight)) + } + if len(m.FinalizationQueue) > 0 { + for _, e := range m.FinalizationQueue { + l = e.Size() + n += 1 + l + sovStateInfo(uint64(l)) + } + } + return n +} + +func sovStateInfo(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozStateInfo(x uint64) (n int) { + return sovStateInfo(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *StateInfoIndex) 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 ErrIntOverflowStateInfo + } + 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: StateInfoIndex: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StateInfoIndex: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + 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 ErrInvalidLengthStateInfo + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + m.Index = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Index |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipStateInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStateInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StateInfo) 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 ErrIntOverflowStateInfo + } + 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: StateInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StateInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateInfoIndex", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStateInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.StateInfoIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sequencer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + 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 ErrInvalidLengthStateInfo + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sequencer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartHeight", wireType) + } + m.StartHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumBlocks", wireType) + } + m.NumBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DaPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + 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 ErrInvalidLengthStateInfo + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DaPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) + } + m.CreationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= Status(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockDescs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStateInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BlockDescs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStateInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStateInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StateInfoSummary) 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 ErrIntOverflowStateInfo + } + 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: StateInfoSummary: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StateInfoSummary: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateInfoIndex", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStateInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.StateInfoIndex.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= Status(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) + } + m.CreationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipStateInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStateInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BlockHeightToFinalizationQueue) 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 ErrIntOverflowStateInfo + } + 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: BlockHeightToFinalizationQueue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlockHeightToFinalizationQueue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) + } + m.CreationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FinalizationQueue", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateInfo + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStateInfo + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStateInfo + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FinalizationQueue = append(m.FinalizationQueue, StateInfoIndex{}) + if err := m.FinalizationQueue[len(m.FinalizationQueue)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStateInfo(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthStateInfo + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipStateInfo(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, ErrIntOverflowStateInfo + } + 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, ErrIntOverflowStateInfo + } + 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, ErrIntOverflowStateInfo + } + 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, ErrInvalidLengthStateInfo + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupStateInfo + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthStateInfo + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthStateInfo = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStateInfo = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupStateInfo = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/rollapp/types/token_metadata.go b/x/rollapp/types/token_metadata.go new file mode 100644 index 00000000..9df221d2 --- /dev/null +++ b/x/rollapp/types/token_metadata.go @@ -0,0 +1,42 @@ +package types + +import ( + "errors" + + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" +) + +// Validate performs a basic validation of the coin metadata fields. +// Inherits from x/bank metadata and following same spec of x/bank/types/metadata.go +func (m *TokenMetadata) Validate() error { + if m == nil { + return errors.New("token metadata cannot be nil") + } + + bankMetadata := m.ConvertToBankMetadata() + return bankMetadata.Validate() +} + +// ConvertToBankMetadata converts TokenMetadata to Metadata of x/bank/types +func (m *TokenMetadata) ConvertToBankMetadata() banktypes.Metadata { + var denomUnits []*banktypes.DenomUnit + + for _, denomUnit := range m.DenomUnits { + denomUnits = append(denomUnits, &banktypes.DenomUnit{ + Denom: denomUnit.Denom, + Exponent: denomUnit.Exponent, + Aliases: denomUnit.Aliases, + }) + } + + return banktypes.Metadata{ + Description: m.Description, + DenomUnits: denomUnits, + Base: m.Base, + Display: m.Display, + Name: m.Name, + Symbol: m.Symbol, + URI: m.URI, + URIHash: m.URIHash, + } +} diff --git a/x/rollapp/types/tx.pb.go b/x/rollapp/types/tx.pb.go new file mode 100644 index 00000000..9f61cbfc --- /dev/null +++ b/x/rollapp/types/tx.pb.go @@ -0,0 +1,1852 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nucleic/rollapp/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "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 + +// MsgCreateRollapp creates a new rollapp chain on the hub. +type MsgCreateRollapp struct { + // creator is the bech32-encoded address of the rollapp creator + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + // rollapp_id is the unique identifier of the rollapp chain. + // The rollapp_id follows the same standard as cosmos chain_id + RollappId string `protobuf:"bytes,2,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` + // max_sequencers is the maximum number of sequencers + MaxSequencers uint64 `protobuf:"varint,6,opt,name=max_sequencers,json=maxSequencers,proto3" json:"max_sequencers,omitempty"` + // permissioned_addresses is a bech32-encoded address list of the + // sequencers that are allowed to serve this rollapp_id. + // In the case of an empty list, the rollapp is considered permissionless + PermissionedAddresses []string `protobuf:"bytes,7,rep,name=permissioned_addresses,json=permissionedAddresses,proto3" json:"permissioned_addresses,omitempty"` + // metadata provides the client information for all the registered tokens. + Metadatas []TokenMetadata `protobuf:"bytes,8,rep,name=metadatas,proto3" json:"metadatas"` + // genesis_accounts for the rollapp on the hub + GenesisAccounts []GenesisAccount `protobuf:"bytes,9,rep,name=genesis_accounts,json=genesisAccounts,proto3" json:"genesis_accounts"` +} + +func (m *MsgCreateRollapp) Reset() { *m = MsgCreateRollapp{} } +func (m *MsgCreateRollapp) String() string { return proto.CompactTextString(m) } +func (*MsgCreateRollapp) ProtoMessage() {} +func (*MsgCreateRollapp) Descriptor() ([]byte, []int) { + return fileDescriptor_eb8b6554f760aaec, []int{0} +} +func (m *MsgCreateRollapp) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateRollapp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateRollapp.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 *MsgCreateRollapp) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateRollapp.Merge(m, src) +} +func (m *MsgCreateRollapp) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateRollapp) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateRollapp.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateRollapp proto.InternalMessageInfo + +func (m *MsgCreateRollapp) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgCreateRollapp) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *MsgCreateRollapp) GetMaxSequencers() uint64 { + if m != nil { + return m.MaxSequencers + } + return 0 +} + +func (m *MsgCreateRollapp) GetPermissionedAddresses() []string { + if m != nil { + return m.PermissionedAddresses + } + return nil +} + +func (m *MsgCreateRollapp) GetMetadatas() []TokenMetadata { + if m != nil { + return m.Metadatas + } + return nil +} + +func (m *MsgCreateRollapp) GetGenesisAccounts() []GenesisAccount { + if m != nil { + return m.GenesisAccounts + } + return nil +} + +type MsgCreateRollappResponse struct { +} + +func (m *MsgCreateRollappResponse) Reset() { *m = MsgCreateRollappResponse{} } +func (m *MsgCreateRollappResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateRollappResponse) ProtoMessage() {} +func (*MsgCreateRollappResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_eb8b6554f760aaec, []int{1} +} +func (m *MsgCreateRollappResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateRollappResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateRollappResponse.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 *MsgCreateRollappResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateRollappResponse.Merge(m, src) +} +func (m *MsgCreateRollappResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateRollappResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateRollappResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateRollappResponse proto.InternalMessageInfo + +// MsgUpdateState updates a rollapp state with a block batch. +// a block batch is a list of ordered blocks (by height) +type MsgUpdateState struct { + // creator is the bech32-encoded address of the sequencer sending the update + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + // rollapp_id is the rollapp that the sequencer belongs to and asking to update + // The rollapp_id follows the same standard as cosmos chain_id + RollappId string `protobuf:"bytes,2,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` + // start_height is the block height of the first block in the batch + StartHeight uint64 `protobuf:"varint,3,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` + // num_blocks is the number of blocks included in this batch update + NumBlocks uint64 `protobuf:"varint,4,opt,name=num_blocks,json=numBlocks,proto3" json:"num_blocks,omitempty"` + // da_path is the description of the location on the DA layer + DaPath string `protobuf:"bytes,5,opt,name=da_path,json=daPath,proto3" json:"da_path,omitempty"` + // version is the version of the rollapp + Version uint64 `protobuf:"varint,6,opt,name=version,proto3" json:"version,omitempty"` + // block_descs is a list of block description objects (one per block) + // the list must be ordered by height, starting from start_height to + // start_height+num_blocks-1 + BlockDescs BlockDescriptors `protobuf:"bytes,7,opt,name=block_descs,json=blockDescs,proto3" json:"block_descs"` +} + +func (m *MsgUpdateState) Reset() { *m = MsgUpdateState{} } +func (m *MsgUpdateState) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateState) ProtoMessage() {} +func (*MsgUpdateState) Descriptor() ([]byte, []int) { + return fileDescriptor_eb8b6554f760aaec, []int{2} +} +func (m *MsgUpdateState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateState.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 *MsgUpdateState) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateState.Merge(m, src) +} +func (m *MsgUpdateState) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateState) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateState.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateState proto.InternalMessageInfo + +func (m *MsgUpdateState) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgUpdateState) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +func (m *MsgUpdateState) GetStartHeight() uint64 { + if m != nil { + return m.StartHeight + } + return 0 +} + +func (m *MsgUpdateState) GetNumBlocks() uint64 { + if m != nil { + return m.NumBlocks + } + return 0 +} + +func (m *MsgUpdateState) GetDaPath() string { + if m != nil { + return m.DaPath + } + return "" +} + +func (m *MsgUpdateState) GetVersion() uint64 { + if m != nil { + return m.Version + } + return 0 +} + +func (m *MsgUpdateState) GetBlockDescs() BlockDescriptors { + if m != nil { + return m.BlockDescs + } + return BlockDescriptors{} +} + +type MsgUpdateStateResponse struct { +} + +func (m *MsgUpdateStateResponse) Reset() { *m = MsgUpdateStateResponse{} } +func (m *MsgUpdateStateResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateStateResponse) ProtoMessage() {} +func (*MsgUpdateStateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_eb8b6554f760aaec, []int{3} +} +func (m *MsgUpdateStateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateStateResponse.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 *MsgUpdateStateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateStateResponse.Merge(m, src) +} +func (m *MsgUpdateStateResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateStateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateStateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateStateResponse proto.InternalMessageInfo + +// MsgRollappGenesisEvent is the message type for triggering the genesis event +// of the rollapp +type MsgRollappGenesisEvent struct { + // address is the bech32-encoded address of the sender + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // channel_id is the rollapp channel id on the hub + ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + // rollapp_id is the rollapp id we want to mint tokens on the hub. + // Used for validation against channel_id to reduce error surface. + RollappId string `protobuf:"bytes,3,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` +} + +func (m *MsgRollappGenesisEvent) Reset() { *m = MsgRollappGenesisEvent{} } +func (m *MsgRollappGenesisEvent) String() string { return proto.CompactTextString(m) } +func (*MsgRollappGenesisEvent) ProtoMessage() {} +func (*MsgRollappGenesisEvent) Descriptor() ([]byte, []int) { + return fileDescriptor_eb8b6554f760aaec, []int{4} +} +func (m *MsgRollappGenesisEvent) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRollappGenesisEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRollappGenesisEvent.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 *MsgRollappGenesisEvent) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRollappGenesisEvent.Merge(m, src) +} +func (m *MsgRollappGenesisEvent) XXX_Size() int { + return m.Size() +} +func (m *MsgRollappGenesisEvent) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRollappGenesisEvent.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRollappGenesisEvent proto.InternalMessageInfo + +func (m *MsgRollappGenesisEvent) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *MsgRollappGenesisEvent) GetChannelId() string { + if m != nil { + return m.ChannelId + } + return "" +} + +func (m *MsgRollappGenesisEvent) GetRollappId() string { + if m != nil { + return m.RollappId + } + return "" +} + +type MsgRollappGenesisEventResponse struct { +} + +func (m *MsgRollappGenesisEventResponse) Reset() { *m = MsgRollappGenesisEventResponse{} } +func (m *MsgRollappGenesisEventResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRollappGenesisEventResponse) ProtoMessage() {} +func (*MsgRollappGenesisEventResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_eb8b6554f760aaec, []int{5} +} +func (m *MsgRollappGenesisEventResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRollappGenesisEventResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRollappGenesisEventResponse.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 *MsgRollappGenesisEventResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRollappGenesisEventResponse.Merge(m, src) +} +func (m *MsgRollappGenesisEventResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRollappGenesisEventResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRollappGenesisEventResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRollappGenesisEventResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCreateRollapp)(nil), "nucleic.rollapp.MsgCreateRollapp") + proto.RegisterType((*MsgCreateRollappResponse)(nil), "nucleic.rollapp.MsgCreateRollappResponse") + proto.RegisterType((*MsgUpdateState)(nil), "nucleic.rollapp.MsgUpdateState") + proto.RegisterType((*MsgUpdateStateResponse)(nil), "nucleic.rollapp.MsgUpdateStateResponse") + proto.RegisterType((*MsgRollappGenesisEvent)(nil), "nucleic.rollapp.MsgRollappGenesisEvent") + proto.RegisterType((*MsgRollappGenesisEventResponse)(nil), "nucleic.rollapp.MsgRollappGenesisEventResponse") +} + +func init() { proto.RegisterFile("nucleic/rollapp/tx.proto", fileDescriptor_eb8b6554f760aaec) } + +var fileDescriptor_eb8b6554f760aaec = []byte{ + // 607 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xdf, 0x6e, 0xd3, 0x30, + 0x14, 0xc6, 0x9b, 0x76, 0x6c, 0xc4, 0x65, 0x7f, 0x14, 0x60, 0x58, 0x91, 0x96, 0x75, 0x95, 0x80, + 0x72, 0x41, 0x23, 0x15, 0xf1, 0x00, 0x2b, 0x20, 0x36, 0x89, 0x4a, 0x53, 0x36, 0x84, 0x84, 0x84, + 0x22, 0x37, 0x39, 0x4a, 0xa2, 0x36, 0x76, 0xb0, 0x9d, 0x51, 0xde, 0x80, 0x4b, 0x9e, 0x84, 0x57, + 0xe0, 0x76, 0x97, 0xbb, 0xe4, 0x0a, 0xa1, 0xed, 0x45, 0x50, 0x5c, 0xa7, 0x6b, 0xd3, 0x4a, 0x43, + 0x5c, 0xb5, 0xfe, 0xbe, 0xcf, 0xe7, 0x38, 0x3f, 0x9f, 0x04, 0x61, 0x9a, 0x07, 0x63, 0x48, 0x02, + 0x97, 0xb3, 0xf1, 0x98, 0x64, 0x99, 0x2b, 0x27, 0xdd, 0x8c, 0x33, 0xc9, 0xac, 0x6d, 0xed, 0x74, + 0xb5, 0x63, 0x3f, 0x88, 0x58, 0xc4, 0x94, 0xe7, 0x16, 0xff, 0xa6, 0x31, 0xfb, 0x49, 0xb5, 0xc0, + 0x70, 0xcc, 0x82, 0x91, 0x1f, 0x82, 0x08, 0x78, 0x92, 0x49, 0xc6, 0x75, 0xce, 0x5e, 0xca, 0x11, + 0x3a, 0xd2, 0xde, 0x5e, 0xd5, 0xd3, 0xbf, 0x53, 0xbb, 0xfd, 0xb3, 0x8e, 0x76, 0x06, 0x22, 0x7a, + 0xc5, 0x81, 0x48, 0xf0, 0xa6, 0x96, 0x85, 0xd1, 0x46, 0x50, 0x08, 0x8c, 0x63, 0xa3, 0x65, 0x74, + 0x4c, 0xaf, 0x5c, 0x5a, 0x7b, 0x08, 0xe9, 0xfd, 0x7e, 0x12, 0xe2, 0xba, 0x32, 0x4d, 0xad, 0x1c, + 0x87, 0xd6, 0x63, 0xb4, 0x95, 0x92, 0x89, 0x2f, 0xe0, 0x73, 0x0e, 0x34, 0x00, 0x2e, 0xf0, 0x7a, + 0xcb, 0xe8, 0xac, 0x79, 0x9b, 0x29, 0x99, 0x9c, 0xce, 0x44, 0xeb, 0x25, 0xda, 0xcd, 0x80, 0xa7, + 0x89, 0x10, 0x09, 0xa3, 0x10, 0xfa, 0x24, 0x0c, 0x39, 0x08, 0x01, 0x02, 0x6f, 0xb4, 0x1a, 0x1d, + 0xd3, 0x7b, 0x38, 0xef, 0x1e, 0x96, 0xa6, 0xd5, 0x47, 0x66, 0x0a, 0x92, 0x84, 0x44, 0x12, 0x81, + 0xef, 0xb6, 0x1a, 0x9d, 0x66, 0xcf, 0xe9, 0x56, 0x48, 0x76, 0xcf, 0xd8, 0x08, 0xe8, 0x40, 0xc7, + 0xfa, 0x6b, 0x17, 0xbf, 0xf7, 0x6b, 0xde, 0xcd, 0x36, 0xeb, 0x04, 0xed, 0x44, 0x40, 0x41, 0x24, + 0xc2, 0x27, 0x41, 0xc0, 0x72, 0x2a, 0x05, 0x36, 0x55, 0xa9, 0xfd, 0xa5, 0x52, 0x6f, 0xa7, 0xc1, + 0xc3, 0x69, 0x4e, 0xd7, 0xda, 0x8e, 0x16, 0x54, 0xd1, 0xb6, 0x11, 0xae, 0x02, 0xf4, 0x40, 0x64, + 0x8c, 0x0a, 0x68, 0x7f, 0xab, 0xa3, 0xad, 0x81, 0x88, 0xde, 0x67, 0x21, 0x91, 0x70, 0x2a, 0x89, + 0x84, 0xff, 0x67, 0x7b, 0x80, 0xee, 0x09, 0x49, 0xb8, 0xf4, 0x63, 0x48, 0xa2, 0x58, 0xe2, 0x86, + 0x22, 0xdb, 0x54, 0xda, 0x91, 0x92, 0x8a, 0x0a, 0x34, 0x4f, 0x7d, 0x35, 0x25, 0x02, 0xaf, 0xa9, + 0x80, 0x49, 0xf3, 0xb4, 0xaf, 0x04, 0xeb, 0x11, 0xda, 0x08, 0x89, 0x9f, 0x11, 0x19, 0xe3, 0x3b, + 0xaa, 0xfa, 0x7a, 0x48, 0x4e, 0x88, 0x8c, 0x8b, 0x33, 0x9d, 0x03, 0x2f, 0x70, 0xeb, 0xfb, 0x2a, + 0x97, 0xd6, 0x11, 0x6a, 0xde, 0xcc, 0x5c, 0x71, 0x3d, 0x46, 0xa7, 0xd9, 0x3b, 0x58, 0x22, 0xa5, + 0x1a, 0xbc, 0x9e, 0x8d, 0xa5, 0xd0, 0xac, 0xd0, 0xb0, 0xd4, 0x45, 0x1b, 0xa3, 0xdd, 0x45, 0x12, + 0x33, 0x48, 0x99, 0x72, 0x34, 0x3a, 0xcd, 0xfc, 0xcd, 0x39, 0x50, 0x59, 0x9c, 0x4b, 0x8f, 0x46, + 0xc9, 0x4a, 0x2f, 0x8b, 0x27, 0x0d, 0x62, 0x42, 0x29, 0x8c, 0xe7, 0x58, 0x69, 0xe5, 0x38, 0xac, + 0xa0, 0x6c, 0x54, 0x50, 0xb6, 0x5b, 0xc8, 0x59, 0xdd, 0xb1, 0x3c, 0x53, 0xef, 0x47, 0x1d, 0x35, + 0x06, 0x22, 0xb2, 0x3e, 0xa1, 0xcd, 0xc5, 0x57, 0x63, 0xf9, 0xd9, 0xab, 0x97, 0x6f, 0x3f, 0xbb, + 0x35, 0x52, 0xb6, 0xb1, 0x3e, 0xa0, 0xe6, 0xfc, 0x6c, 0xec, 0xaf, 0xda, 0x39, 0x17, 0xb0, 0x9f, + 0xde, 0x12, 0x98, 0x15, 0x66, 0xe8, 0xfe, 0x19, 0x4f, 0xa2, 0x08, 0xf8, 0x02, 0xd0, 0x95, 0xfb, + 0x57, 0x70, 0xb0, 0xdd, 0x7f, 0x0c, 0x96, 0x0d, 0xfb, 0xef, 0x2e, 0xae, 0x1c, 0xe3, 0xf2, 0xca, + 0x31, 0xfe, 0x5c, 0x39, 0xc6, 0xf7, 0x6b, 0xa7, 0x76, 0x79, 0xed, 0xd4, 0x7e, 0x5d, 0x3b, 0xb5, + 0x8f, 0xbd, 0x28, 0x91, 0x71, 0x3e, 0xec, 0x06, 0x2c, 0x75, 0x75, 0xd1, 0xe7, 0x14, 0xe4, 0x17, + 0xc6, 0x47, 0xe5, 0xda, 0x9d, 0xdc, 0x7c, 0x22, 0xbf, 0x66, 0x20, 0x86, 0xeb, 0xea, 0xe3, 0xf4, + 0xe2, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3f, 0xd6, 0xea, 0x8f, 0x42, 0x05, 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 { + CreateRollapp(ctx context.Context, in *MsgCreateRollapp, opts ...grpc.CallOption) (*MsgCreateRollappResponse, error) + UpdateState(ctx context.Context, in *MsgUpdateState, opts ...grpc.CallOption) (*MsgUpdateStateResponse, error) + TriggerGenesisEvent(ctx context.Context, in *MsgRollappGenesisEvent, opts ...grpc.CallOption) (*MsgRollappGenesisEventResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateRollapp(ctx context.Context, in *MsgCreateRollapp, opts ...grpc.CallOption) (*MsgCreateRollappResponse, error) { + out := new(MsgCreateRollappResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Msg/CreateRollapp", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateState(ctx context.Context, in *MsgUpdateState, opts ...grpc.CallOption) (*MsgUpdateStateResponse, error) { + out := new(MsgUpdateStateResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Msg/UpdateState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) TriggerGenesisEvent(ctx context.Context, in *MsgRollappGenesisEvent, opts ...grpc.CallOption) (*MsgRollappGenesisEventResponse, error) { + out := new(MsgRollappGenesisEventResponse) + err := c.cc.Invoke(ctx, "/nucleic.rollapp.Msg/TriggerGenesisEvent", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + CreateRollapp(context.Context, *MsgCreateRollapp) (*MsgCreateRollappResponse, error) + UpdateState(context.Context, *MsgUpdateState) (*MsgUpdateStateResponse, error) + TriggerGenesisEvent(context.Context, *MsgRollappGenesisEvent) (*MsgRollappGenesisEventResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateRollapp(ctx context.Context, req *MsgCreateRollapp) (*MsgCreateRollappResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateRollapp not implemented") +} +func (*UnimplementedMsgServer) UpdateState(ctx context.Context, req *MsgUpdateState) (*MsgUpdateStateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateState not implemented") +} +func (*UnimplementedMsgServer) TriggerGenesisEvent(ctx context.Context, req *MsgRollappGenesisEvent) (*MsgRollappGenesisEventResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TriggerGenesisEvent not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateRollapp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateRollapp) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateRollapp(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Msg/CreateRollapp", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateRollapp(ctx, req.(*MsgCreateRollapp)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateState) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Msg/UpdateState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateState(ctx, req.(*MsgUpdateState)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_TriggerGenesisEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRollappGenesisEvent) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).TriggerGenesisEvent(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nucleic.rollapp.Msg/TriggerGenesisEvent", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).TriggerGenesisEvent(ctx, req.(*MsgRollappGenesisEvent)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "nucleic.rollapp.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateRollapp", + Handler: _Msg_CreateRollapp_Handler, + }, + { + MethodName: "UpdateState", + Handler: _Msg_UpdateState_Handler, + }, + { + MethodName: "TriggerGenesisEvent", + Handler: _Msg_TriggerGenesisEvent_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "nucleic/rollapp/tx.proto", +} + +func (m *MsgCreateRollapp) 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 *MsgCreateRollapp) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateRollapp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.GenesisAccounts) > 0 { + for iNdEx := len(m.GenesisAccounts) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.GenesisAccounts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + } + if len(m.Metadatas) > 0 { + for iNdEx := len(m.Metadatas) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Metadatas[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } + if len(m.PermissionedAddresses) > 0 { + for iNdEx := len(m.PermissionedAddresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.PermissionedAddresses[iNdEx]) + copy(dAtA[i:], m.PermissionedAddresses[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.PermissionedAddresses[iNdEx]))) + i-- + dAtA[i] = 0x3a + } + } + if m.MaxSequencers != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.MaxSequencers)) + i-- + dAtA[i] = 0x30 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateRollappResponse) 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 *MsgCreateRollappResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateRollappResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateState) 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 *MsgUpdateState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.BlockDescs.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + if m.Version != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x30 + } + if len(m.DaPath) > 0 { + i -= len(m.DaPath) + copy(dAtA[i:], m.DaPath) + i = encodeVarintTx(dAtA, i, uint64(len(m.DaPath))) + i-- + dAtA[i] = 0x2a + } + if m.NumBlocks != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.NumBlocks)) + i-- + dAtA[i] = 0x20 + } + if m.StartHeight != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.StartHeight)) + i-- + dAtA[i] = 0x18 + } + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateStateResponse) 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 *MsgUpdateStateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgRollappGenesisEvent) 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 *MsgRollappGenesisEvent) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRollappGenesisEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RollappId) > 0 { + i -= len(m.RollappId) + copy(dAtA[i:], m.RollappId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RollappId))) + i-- + dAtA[i] = 0x1a + } + if len(m.ChannelId) > 0 { + i -= len(m.ChannelId) + copy(dAtA[i:], m.ChannelId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChannelId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRollappGenesisEventResponse) 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 *MsgRollappGenesisEventResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRollappGenesisEventResponse) 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 *MsgCreateRollapp) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.MaxSequencers != 0 { + n += 1 + sovTx(uint64(m.MaxSequencers)) + } + if len(m.PermissionedAddresses) > 0 { + for _, s := range m.PermissionedAddresses { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + if len(m.Metadatas) > 0 { + for _, e := range m.Metadatas { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + if len(m.GenesisAccounts) > 0 { + for _, e := range m.GenesisAccounts { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgCreateRollappResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.StartHeight != 0 { + n += 1 + sovTx(uint64(m.StartHeight)) + } + if m.NumBlocks != 0 { + n += 1 + sovTx(uint64(m.NumBlocks)) + } + l = len(m.DaPath) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Version != 0 { + n += 1 + sovTx(uint64(m.Version)) + } + l = m.BlockDescs.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateStateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRollappGenesisEvent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ChannelId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.RollappId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRollappGenesisEventResponse) 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 *MsgCreateRollapp) 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: MsgCreateRollapp: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateRollapp: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", 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.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", 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.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxSequencers", wireType) + } + m.MaxSequencers = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxSequencers |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PermissionedAddresses", 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.PermissionedAddresses = append(m.PermissionedAddresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadatas", 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.Metadatas = append(m.Metadatas, TokenMetadata{}) + if err := m.Metadatas[len(m.Metadatas)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GenesisAccounts", 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.GenesisAccounts = append(m.GenesisAccounts, GenesisAccount{}) + if err := m.GenesisAccounts[len(m.GenesisAccounts)-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 *MsgCreateRollappResponse) 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: MsgCreateRollappResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateRollappResponse: 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 *MsgUpdateState) 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: MsgUpdateState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", 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.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", 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.RollappId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartHeight", wireType) + } + m.StartHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumBlocks", wireType) + } + m.NumBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumBlocks |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DaPath", 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.DaPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockDescs", 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.BlockDescs.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 *MsgUpdateStateResponse) 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: MsgUpdateStateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateStateResponse: 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 *MsgRollappGenesisEvent) 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: MsgRollappGenesisEvent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRollappGenesisEvent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", 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.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.ChannelId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RollappId", 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.RollappId = string(dAtA[iNdEx:postIndex]) + 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 *MsgRollappGenesisEventResponse) 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: MsgRollappGenesisEventResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRollappGenesisEventResponse: 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") +)